GithubHelp home page GithubHelp logo

redux_dev_tools's Introduction

redux_dev_tools

Build Status codecov

A Redux Store with a Delorean.

This library allows you to create a DevToolsStore during dev mode in place of a normal Redux Store. This DevToolsStore will act exactly like a normal Store at first, with one catch: It will allow you to travel back and forth throughout the State of your application!

You can write your own UI to travel in time, or use one of the existing options for the platform you're working with:

Demo

Flutter

A simple Flutter app that allows you to Increment and Decrement a counter.

A screenshot of the Dev Tools in Action

Usage

// Start by creating a simple Reducer, or a complex one. Dealer's choice. :)
int addOneReducer(int state, action) => state + 1;

// For production mode, this is how you should create your Store.
final store = Store(addReducer, initialState: 0);

// In Dev Mode, however, if you want to hook up to Time-Traveling 
// Dev Tools, create a `DevToolsStore` instead!
//
// It will act exactly like your normal Store, but give you super powers
// to travel back and forth in time throughout your app States!
// 
// Remember: By itself this will beef up your Store, but will not provide
// a UI to Time Travel. See the libraries listed above to learn how to
// connect your Redux store to a UI! 
final store = DevToolsStore(addReducer, initialState: 0);

Credits

All of this code was directly inspired by the original Redux Devtools.

redux_dev_tools's People

Contributors

brianegan avatar michaelmarner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

redux_dev_tools's Issues

Null Safety

I'm in the process of migrating redux_remote_devtools to null safety, which depends on this package. Any plans to migrate this one (or are you happy for me to do it and submit a PR?)

Add debug info to Actions

Hi, one thing I've come across often is trying to figure out where an action was dispatched from. Usually, with functions, we have easy action to the stacktrace, but not in this case. I solved this by adding the following code to the store.dart file.

@override
 void dispatch(dynamic action) {
   if (action is DevToolsAction) {
     _devToolsStore.dispatch(action);
   } else {
     StackTrace stacktrace = StackTrace.current;
     final traceLines = stacktrace.toString().split('\n');
     var callingFunction = traceLines[1].replaceAll('#1      ', '');
     debugPrint("Calling Function: $callingFunction");
     _devToolsStore.dispatch(new DevToolsAction.perform(action));
   }
 }

This prints out the calling function and line number it came from.
This needs a better job done to make it useful, but it's a good start.
It would be nice if all actions could be wrapped in an object that added specific debug information in it's properties and could be automatically added to the toString info

I tried forking and adding it myself, but I got the following error, which I didn't understand.

The current Dart SDK version is 2.6.0-dev.0.0.flutter-6ff8d2199d.

Because redux_dev_tools depends on test >=0.12.0-beta.3 <1.3.0 which requires SDK version >=1.8.0 <2.0.0-โˆž, version solving failed.

pub get failed (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.