GithubHelp home page GithubHelp logo

redbrogdon / rebloc Goto Github PK

View Code? Open in Web Editor NEW
214.0 12.0 21.0 314 KB

A state management library for Flutter that combines aspects of Redux and BLoC.

License: BSD 3-Clause "New" or "Revised" License

Dart 91.12% Java 0.29% Objective-C 1.62% Shell 1.27% Kotlin 0.25% Swift 2.37% HTML 3.08%

rebloc's People

Contributors

devoncarew avatar redbrogdon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rebloc's Issues

Invalid override?

Given the following code:

Default override fill in code:

@override
  FutureOr<Action> middleware(DispatchFunction dispatcher, ExpandingCardState state, Action action) {
    // TODO: implement middleware
    return super.middleware(dispatcher, state, action);
  }

or Modified to return action explicitly

class ConstraintBloc extends SimpleBloc<ExpandingCardState> {
  @override
  FutureOr<Action> middleware(DispatchFunction dispatcher, ExpandingCardState state, Action action) {
    // TODO: implement middleware
    return action;
  }
}

Why do I get the following analysis error?

'ConstraintBloc.middleware' ('((Action) → void, ExpandingCardState, Action) → dynamic') isn't a valid override of 'SimpleBloc.middleware' ('((Action) → void,

statefulwidget

I found the statelesswidget used in it all. Does this have any effect on performance?

don't update the store were cancelled action returned by the reducer

a quick fix:

--- engine.dart
+++ engine.dart
@@ -104,8 +104,10 @@
 
     reducerStream.listen((a) {
       assert(a.state != null);
-      states.add(a.state);
-      _afterwareController.add(WareContext<S>(dispatcher, a.state, a.action));
+      if (a.action is! _CancelledAction) {
+        states.add(a.state);
+        _afterwareController.add(WareContext<S>(dispatcher, a.state, a.action));
+      }
     });
 
     // Without something listening, the afterware won't be executed.

initialState Async

I have a usecase in my app and I need to load the initial state by querying the SharedPreferences package.

How can I make the initial state of my app asynchronous?

Rebloc Usage with text entry

Thanks for the great library rebloc. I am trying to figure out how I can use a SimpleBloc with a widget that has TextFields.

I have seen samples where the standard BLOC exposed streams and functions that access the sinks, and are wired to StreamBuilder that return the TextField.

If I used rebloc, would I have to maintain state and validate the TextField within the widget, and simply dispatch actions for something like the login passing the username/password?

I liked the separation and hidden logic within the standard BLOC, but not sure how to use a VIewModelSubscriber in place of a StreamBuilder while exposing Streams/Sinks from the SimpleBloc.

Rebloc + Firebase

Hello @RedBrogdon

Thanks for the package, since I stumbled upon it, its been my number choice for state management.

This question has been asked before, so I took time out to repurpose one of my earlier projects from Redux to Rebloc.

You can have a look at TailorMade and maybe you can give a shout if it can serve as a pointer for others wanting to use this combination.

Jeremiah.

Dispatch an action from the context of extended SimpleBloc

Hi,

In my bloc class I listen to location event. How can I dispatch an action on each event?

class TrackingBloc extends SimpleBloc<AppState> {
    ...
    bg.BackgroundGeolocation.onLocation((bg.Location location) {
        dispatcher(DoSomethinWithLocation(location));
    }
    ...
}

Need update dependencies

Thanks for the great library!
Could you help to update the dependencies to follow the latest release? Thanks!

Use outside of Flutter?

Is it possible to use this app with AngularDart or VueDart?

If so, some examples would be awesome.

Awesome!

Since there is nowhere else to say this, Thank you @RedBrogdon.

This is super awesome!!

FAILURE: Build failed with an exception.

When I opened example, two errors occurred. Provide solutions for those in need.

First mistake, No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android.
2020-07-23_193542

Solution, go to the official website to download "Android NDK, Revision 16b", and then put the "mips64el-linux-android-4.9" in "Android\sdk\ndk-bundle".
https://developer.android.com/ndk/downloads/older_releases
2020-07-23_194025

Second mistake, Failed to execute aapt.
2020-07-23_193838

Solution, in "android/app/build.gradle", modify "compileSdkVersion" to 28.
2020-07-23_194123

Missing post-reducer middleware functionality

Nice redesign of the redux ideas. I've been doing something similar (still WIP), but with blocs keeping their state as an accumulated state in a stream, using the stream's scan() to call its reducer.

What seems to be missing in rebloc, but what I used frequently with react-redux in the past, is the ability to execute middleware functions after the reducer(s) have changed the state. For example, after changing the state you may want to perform some external actions, like logging, sending a network message about the finished action (MQTT in my case), etc. In react-redux, everything after next(action) in the middleware function could do this.

Wondering whether you could think about how to add this functionality in some way to rebloc.

Any example rebloc and firebase

I think this plugin is so brilliant and make state management much easier!
Thank you so much.
However I would like to know how to update UI when Firestore data changed or created in this plugin. For instance, when you put a new item in shopping cart, cart icon's number updates like flutter talk in IO. Since bloc attached to this plugin, I think I should put login in there but I'm not sure how to do it. Could you give an example?
Again thank you for great plugin.

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.