Code Monkey home page Code Monkey logo

flutter_architecture_samples's Issues

Hot reloading rejected

This happens to be when running the Redux example. Guessing it probably impacts all the examples.

Appears to be related to deferred loading:
"Hot reload was rejected:
Reloading support for deferred loading has not yet been implemented: library 'package:flutter/src/gestures/converter.dart' has deferred import 'messages_en'"

error while running bloc_flutter

running flutter run --debug in the folder example/bloc_flutter
I am getting this output:

Installing build/app/outputs/apk/app.apk...                  2,2s
E/flutter ( 8583): [ERROR:flutter/shell/common/shell.cc(181)] Dart Error: Unhandled exception:
E/flutter ( 8583): NoSuchMethodError: The getter 'updateTodo' was called on null.
E/flutter ( 8583): Receiver: null
E/flutter ( 8583): Tried calling: updateTodo
E/flutter ( 8583): #0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:48:5)
E/flutter ( 8583): #1      new TodosListBloc (package:blocs/src/todos_list_bloc.dart:52:53)
E/flutter ( 8583): #2      main (file:///Users/juliocotta/git/flutter_architecture_samples/example/bloc_flutter/lib/main.dart:27:13)
E/flutter ( 8583): #3      _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:289:19)
E/flutter ( 8583): #4      _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
Syncing files to device Android SDK built for x86...         4,1s

Should I be running it in a different way?

built_redux some tests failing

FYI: 3 out of 19 tests in built_redux are currently failing.

BTW: I can do a pull request for CI test and code coverage report if interested from this fork.

What would cause a Flutter Redux StoreConnector to not rebuild.

I try to follow the issues religiously on the flutter_architecture_sample. Thank you, to all of you that contribute and ask questions. It helps a lot. I have not seen an issue like this and I could not find the right search query to bring up anything close to my problem. I would really appreciate some help if anyone has an idea as to why this StoreBuilder is not rebuilding. The underlying state of the reducer is two Map<String, Whatevers>'s. I tried to add code without overwhelming the post.

    #View
    return ListView.builder(
                itemCount: eventIDs.length,
                itemBuilder: (BuildContext context, int i) {
                  return StoreConnector<AppState, EventsPageViewModel>(
                      rebuildOnChange: true,
                      onDidChange: (EventsPageViewModel events) {print('${events}');},
                      onInit: (store) =>
                          store.dispatch(FetchEventAction(id: eventIDs[i])),
                      converter: (store) => EventsPageViewModel.fromStore(store),
                      builder: (BuildContext context, EventsPageViewModel events) {
                        print("build ListItem $i ${eventIDs[i]}");
                        if (events.events.containsKey('${eventIDs[i]}')) {
                          return EventCard(
                            event: events.events[eventIDs[i]],
                          );
                        }
                        return Container(
                          child: Card(
                            child: Container(
                              height: 120.0,
                            ),
                          ),
                        );
                      });
                },
              );
    #State
    @immutable
    class Events {
      Events({
        this.loadingStatus,
        this.events,
      });

      factory Events.initial() {
        return Events(
          loadingStatus: Map<String, LoadingStatus>(),
          events: Map<String, EventModel>(),
        );
      }

      final Map<String, LoadingStatus> loadingStatus;
      final Map<String, EventModel> events;

      Events copyWith({
        Map<String, LoadingStatus> loadingStatus,
        Map<String, EventModel> events,
      }) {
        return Events(
          loadingStatus: loadingStatus ?? this.loadingStatus,
          events: events ?? this.events,
        );
      }

      @override
      bool operator ==(Object other) =>
          identical(this, other) ||
          other is Events &&
              runtimeType == other.runtimeType &&
              loadingStatus == other.loadingStatus &&
              const MapEquality().equals(events, other.events);

     @override
     int get hashCode => loadingStatus.hashCode ^ const MapEquality().hash(events);
    }


    #ViewModel
    class EventsPageViewModel {
      EventsPageViewModel({
       @required this.status,
       @required this.events,
     });

     final Map<String, LoadingStatus> status;
     final Map<String, EventModel> events;

     static EventsPageViewModel fromStore(
       Store<AppState> store,
     ) {
       return EventsPageViewModel(
         status: store.state.events.loadingStatus,
         events: store.state.events.events,
       );
     }

     @override
     bool operator ==(Object other) =>
         identical(this, other) ||
         other is EventsPageViewModel &&
             runtimeType == other.runtimeType &&
             status == other.status &&
             const MapEquality().equals(events, other.events);

     @override
     int get hashCode => status.hashCode ^ const MapEquality().hash(events);
    }

I'm trying to get a view to rebuild after it fire off an async action and it return a value to a Map. I don't know if i'm doing the equality check properly

I checked to see if the middleware was firing off the GET Request. It is.
I checked to see if the GET request was returning information. It is.
I have another async action that is firing. That one returns a List of string and does trigger a rebuild on its StoreConnector.

Does anyone have any clues as to why the StoreConnector does not detect a diff?

PageView built_redux

Hey
I would be interested in options integrating PageView Widget for swiping tabs and basically I'm not sure where should PageController go and how it should listen for changes. Any ideas?

Flutter driver integration test does not test data input

Inputting a new task is not implemented in the current integration test.

FYI: It appears to be possible now. The fix for me was to convert to a stateful widget and use only one global key for the form instead of additional global keys for the individual fields. I was able to get it working in the redux project. The added integration test passes.

Happy to try to fix it in the other projects and submit a PR at some point if this sounds useful (might need some pointers for other projects). Please let me know πŸ‘

Built Redux example package dependency question

Hey there,

When trying to run flutter packages get for the built redux example, it currently fails with the following output:

Because every version of flutter_test from sdk depends on analyzer 0.31.2-alpha.2 and build_runner >=0.3.4 <=0.7.9 depends on analyzer >=0.27.1 <0.31.0, flutter_test from sdk is incompatible with build_runner >=0.3.4 <=0.7.9.
So, because built_redux_sample depends on both build_runner ^0.6.0 and flutter_test any from sdk, version solving failed.
pub get failed (1)

flutter --version output:

Flutter 0.4.5-pre.69 β€’ channel dev β€’ https://github.com/flutter/flutter.git
Framework β€’ revision 6c03a3f96b (4 days ago) β€’ 2018-05-22 15:57:41 -0700
Engine β€’ revision f876bd5710
Tools β€’ Dart 2.0.0-dev.55.0.flutter-97b6c2e09d

Trying to solve this, but any help or insight is much appreciated.

As a side note Dart2 is disabled via the flutter plugin.

error with redux-firestore example on latest flutter beta

hey everyone,

im trying to run the redux-firestore example on latest flutter beta and I get this error:

>gradlew assembleDebug --info > debug.txt

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

[Redux] Pop current route after the store has changed ?

Hi @brianegan ! First, thanks a lot for all your work on Flutter! That's amazing and very helpful!

I am currently developing an app in Flutter for a client and I chose the redux way... I currently have a little trouble to manage the navigation.
Let's say I have a home screen with a Login button. The button simply ask the navigator to push a named route /login. The login screen has a form and a StoreConnector with a converter that returns a store.dispatch(LoginAction(formData)). The LoginAction is caught by a specific middleware that will swallow it, do the asynchronous login and finally dispatch a UserIsLoggedInAction to the store.

How can I do this in the login screen itself, since it is something totally asynchronous ?

What is then the best practice to make the login screen pop? Should it be triggered by the middleware? If so, it means that I need to inject a GlobalKey<NavigatorState> key in all the middlewares that can potentially change the routes?

It feels a bit fragile to me. I've read on some other threads that we're better off not including the navigation in the app state and let Flutter do its thing with the Navigator, but I am confused on how to synchronize both worlds in terms of navigation, current screen, etc..

Any advice ?

MVU example

Looks like Flutter is perfect for Model View Update (or The Elm Architecture) pattern.
I've already created example and would love to create PR and contribute πŸ™‹β€β™‚οΈ

Comments on the Vanilla example

A couple of comments.

  1. The vanilla sample is too complex for a flutter/dart beginner. The discussion located at flutter_architecture_samples/example/vanilla/ is useful in explaining how flutter can implement inter-widget communications out of the box. However, IMHO it is extraordinarily complex. It has pieces scattered all over the directory structure. Is there a simpler example? Somewhere you wrote that for multiple state values, I might try a Map. Vanilla was the closest example I could find. The example at https://medium.com/@maksimrv/reactive-app-state-in-flutter-73f829bcf6a7 is fine for a single state value but offers no help with multiple values.

  2. The following code (from flutter_architecture_samples-master\example\vanilla\lib\models.dart) presumably (from its name) toggles the value of the complete member of each TodoEntry

  void toggleAll() {
    final allCompleted = this.allComplete;

    todos.forEach((todo) => todo.complete = !allCompleted);
  } 

Why is allCompleted invoked? Why doesn't the code read

todos.forEach((todo) => todo.complete = !todo.complete);

If that was not what was intended, then the method's name should changed or a /// comment added preceding the declaration.

Kudos: Thank you for your teaching efforts. It is fantastic work!

IntelliJ indicates red underlined errors on all the source but it runs

When I open the projects here in IntelliJ (for example Vanilla), it underlines pretty much everything in code with red, indicating errors. However, it runs just fine. Why may this be and how should I overcome this?

I'm opening the folders under examples/ as IntelliJ projects. I opened the top level folder in IntelliJ and still had the same thing and could not figure out how to run individual projects like that.

How should I open these in IntelliJ?

An MVC Contribution

Good Evening, Brian

I was hoping to make a further contribution to this wonderful project. Recently built a plugin, mvc_pattern, as a offering to our fledgling Flutter community. It provides a framework using the MVC design pattern.

I have cloned Flutter Arichitecture Samples and included a new example under a branch called mvc_sample.

Currently, I have my contribution in a 'copy' on my own account: Flutter Arichitecture Samples.

Please, I offer this for your consideration.

Best Regards,

Greg Perry

Support Dart2

Running into a few type errors

Launching lib/main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
compiler message: file:///media/scott/Data%20SSD/Coding/Flutter/Git%20Projects/Brians%20Stuff/lib/src/localization.dart:13:55: Error: A value of type '(dart.core::Null) β†’ #lib1::ArchSampleLocalizations' can't be assigned to a variable of type '(dynamic) β†’ dart.async::FutureOr<#lib1::ArchSampleLocalizations>'.
compiler message: Try changing the type of the left hand side, or casting the right hand side to '(dynamic) β†’ dart.async::FutureOr<#lib1::ArchSampleLocalizations>'.
compiler message: return initializeMessages(locale.toString()).then((Null value) {
compiler message: ^
Built build/app/outputs/apk/app-debug.apk (28.3MB).
Installing build/app/outputs/apk/app.apk...
I/FlutterActivityDelegate(20357): onResume setting current activity to this
E/flutter (20357): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] error: Unsupported tag at this point: 14.
E/flutter (20357): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Dart_GetClosure expects argument 'library' to be non-null.
D/EGL_emulation(20357): eglMakeCurrent: 0xa84058a0: ver 2 0 (tinfo 0x9141c150)
Syncing files to device Android SDK built for x86...
compiler message: Unhandled exception:
compiler message: NoSuchMethodError: The getter 'dependencies' was called on null.
compiler message: Receiver: null
compiler message: Tried calling: dependencies
compiler message: #0 Object.noSuchMethod (dart:core-patch/dart:core/object_patch.dart:46)
compiler message: #1 BinaryBuilder.readLibraryDependencyReference (package:kernel/binary/ast_from_binary.dart:535)
compiler message: #2 BinaryBuilder.readExpression (package:kernel/binary/ast_from_binary.dart:1179)
compiler message: #3 BinaryBuilder.readExpressionOption (package:kernel/binary/ast_from_binary.dart:1167)
compiler message: #4 BinaryBuilder.readVariableDeclaration (package:kernel/binary/ast_from_binary.dart:1787)
compiler message: #5 BinaryBuilder.readExpression (package:kernel/binary/ast_from_binary.dart:1384)
compiler message: #6 BinaryBuilder.readExpressionOption (package:kernel/binary/ast_from_binary.dart:1167)
compiler message: #7 BinaryBuilder.readStatement (package:kernel/binary/ast_from_binary.dart:1541)
compiler message: #8 BinaryBuilder.readStatementList (package:kernel/binary/ast_from_binary.dart:1441)
compiler message: #9 BinaryBuilder.readBlock (package:kernel/binary/ast_from_binary.dart:1605)
compiler message: #10 BinaryBuilder.readStatement (package:kernel/binary/ast_from_binary.dart:1465)
compiler message: #11 BinaryBuilder.readSwitchCaseInto (package:kernel/binary/ast_from_binary.dart:1579)
compiler message: #12 BinaryBuilder.readStatement (package:kernel/binary/ast_from_binary.dart:1525)
compiler message: #13 BinaryBuilder.readStatementList (package:kernel/binary/ast_from_binary.dart:1441)
compiler message: #14 BinaryBuilder.readBlock (package:kernel/binary/ast_from_binary.dart:1605)
compiler message: #15 BinaryBuilder.readStatement (package:kernel/binary/ast_from_binary.dart:1465)
compiler message: #16 BinaryBuilder.readStatementOption (package:kernel/binary/ast_from_binary.dart:1456)
compiler message: #17 BinaryBuilder._setLazyLoadFunction.<anonymous closure> (package:kernel/binary/ast_from_binary.dart:1118)
compiler message: #18 FunctionNode._buildLazy (package:kernel/ast.dart:1918)
compiler message: #19 FunctionNode.body (package:kernel/ast.dart:1923)
compiler message: #20 BinaryPrinter.visitFunctionNode (package:kernel/binary/ast_to_binary.dart:881)
compiler message: #21 FunctionNode.accept (package:kernel/ast.dart:1978)
compiler message: #22 BinaryPrinter.writeNode (package:kernel/binary/ast_to_binary.dart:220)
compiler message: #23 LimitedBinaryPrinter.writeNode (package:kernel/binary/limited_ast_to_binary.dart:55)
compiler message: #24 BinaryPrinter.writeOptionalNode (package:kerne

simple_bloc_flutter compile error

I'm trying to run the simple_bloc_flutter example and am getting the error below when trying to run on an iPhone X simulator. I'm running in IntelliJ Ultimate 2018.1.

Starting Xcode build...
Xcode build done.
Failed to build iOS app
Error output from Xcode build:
↳
    ** BUILD FAILED **
    
Xcode's output:
↳
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:5:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/Flutter.h:37:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterAppDelegate.h:11:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h:80:42: warning: 'UIUserNotificationSettings' is only available on iOS 8.0 or newer [-Wunguarded-availability]
        didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings;
                                             ^
    In module 'UIKit' imported from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Target Support Files/firebase_auth/firebase_auth-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIUserNotificationSettings.h:43:12: note: 'UIUserNotificationSettings' has been explicitly marked partial here
    @interface UIUserNotificationSettings : NSObject
               ^
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:5:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/Flutter.h:37:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterAppDelegate.h:11:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h:79:1: note: annotate 'application:didRegisterUserNotificationSettings:' with an availability attribute to silence this warning
    - (void)application:(UIApplication*)application
    ^
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h:95:44: warning: 'UIBackgroundFetchResult' is only available on iOS 7.0 or newer [-Wunguarded-availability]
              fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
                                               ^
    In module 'UIKit' imported from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Target Support Files/firebase_auth/firebase_auth-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:76:29: note: 'UIBackgroundFetchResult' has been explicitly marked partial here
    typedef NS_ENUM(NSUInteger, UIBackgroundFetchResult) {
                                ^
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:5:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/Flutter.h:37:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterAppDelegate.h:11:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h:93:1: note: annotate 'application:didReceiveRemoteNotification:fetchCompletionHandler:' with an availability attribute to silence this warning
    - (BOOL)application:(UIApplication*)application
    ^
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h:140:58: warning: this block declaration is not a prototype [-Wstrict-prototypes]
                          completionHandler:(nonnull void (^)())completionHandler;
                                                             ^
                                                              void
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h:148:49: warning: 'UIBackgroundFetchResult' is only available on iOS 7.0 or newer [-Wunguarded-availability]
        performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler;
                                                    ^
    In module 'UIKit' imported from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Target Support Files/firebase_auth/firebase_auth-prefix.pch:2:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:76:29: note: 'UIBackgroundFetchResult' has been explicitly marked partial here
    typedef NS_ENUM(NSUInteger, UIBackgroundFetchResult) {
                                ^
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:5:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/Flutter.h:37:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterAppDelegate.h:11:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h:147:1: note: annotate 'application:performFetchWithCompletionHandler:' with an availability attribute to silence this warning
    - (BOOL)application:(UIApplication*)application
    ^
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:69:53: error: incompatible block pointer types sending 'void (^)(FIRUser *__strong, NSError *__strong)' to parameter of type 'FIRAuthDataResultCallback _Nullable' (aka 'void (^)(FIRAuthDataResult * _Nullable __strong, NSError * _Nullable __strong)')
        [[FIRAuth auth] signInAnonymouslyWithCompletion:^(FIRUser *user, NSError *error) {
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:21:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRAuth.h:525:77: note: passing argument to parameter 'completion' here
    - (void)signInAnonymouslyWithCompletion:(nullable FIRAuthDataResultCallback)completion;
                                                                                ^
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:77:21: warning: 'signInWithCredential:completion:' is deprecated: Please use signInAndRetrieveDataWithCredential:completion: for Objective-C or signInAndRetrieveData(with:completion:) for Swift instead. [-Wdeprecated-declarations]
        [[FIRAuth auth] signInWithCredential:credential
                        ^
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:21:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRAuth.h:462:73: note: 'signInWithCredential:completion:' has been explicitly marked deprecated here
                      completion:(nullable FIRAuthResultCallback)completion DEPRECATED_MSG_ATTRIBUTE(
                                                                            ^
    In module 'Darwin' imported from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterViewController.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/AvailabilityMacros.h:178:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
                #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
                                                                   ^
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:84:21: warning: 'signInWithCredential:completion:' is deprecated: Please use signInAndRetrieveDataWithCredential:completion: for Objective-C or signInAndRetrieveData(with:completion:) for Swift instead. [-Wdeprecated-declarations]
        [[FIRAuth auth] signInWithCredential:credential
                        ^
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:21:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRAuth.h:462:73: note: 'signInWithCredential:completion:' has been explicitly marked deprecated here
                      completion:(nullable FIRAuthResultCallback)completion DEPRECATED_MSG_ATTRIBUTE(
                                                                            ^
    In module 'Darwin' imported from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterViewController.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/AvailabilityMacros.h:178:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
                #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
                                                                   ^
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:93:21: warning: 'signInWithCredential:completion:' is deprecated: Please use signInAndRetrieveDataWithCredential:completion: for Objective-C or signInAndRetrieveData(with:completion:) for Swift instead. [-Wdeprecated-declarations]
        [[FIRAuth auth] signInWithCredential:credential
                        ^
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:21:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRAuth.h:462:73: note: 'signInWithCredential:completion:' has been explicitly marked deprecated here
                      completion:(nullable FIRAuthResultCallback)completion DEPRECATED_MSG_ATTRIBUTE(
                                                                            ^
    In module 'Darwin' imported from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterViewController.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/AvailabilityMacros.h:178:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
                #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
                                                                   ^
Could not build the application for the simulator.
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:102:41: error: incompatible block pointer types sending 'void (^)(FIRUser *__strong, NSError *__strong)' to parameter of type 'FIRAuthDataResultCallback _Nullable' (aka 'void (^)(FIRAuthDataResult * _Nullable __strong, NSError * _Nullable __strong)')
Error launching application on iPhone X.
                                 completion:^(FIRUser *user, NSError *error) {
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:21:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRAuth.h:598:65: note: passing argument to parameter 'completion' here
                     completion:(nullable FIRAuthDataResultCallback)completion;
                                                                    ^
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:130:37: error: incompatible block pointer types sending 'void (^)(FIRUser *__strong, NSError *__strong)' to parameter of type 'FIRAuthDataResultCallback _Nullable' (aka 'void (^)(FIRAuthDataResult * _Nullable __strong, NSError * _Nullable __strong)')
                             completion:^(FIRUser *user, NSError *error) {
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:21:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRAuth.h:379:61: note: passing argument to parameter 'completion' here
                 completion:(nullable FIRAuthDataResultCallback)completion;
                                                                ^
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:153:33: warning: 'linkWithCredential:completion:' is deprecated: Please use linkAndRetrieveDataWithCredential:completion: for Objective-C or linkAndRetrieveData(WithCredential:completion:) for Swift instead. [-Wdeprecated-declarations]
        [[FIRAuth auth].currentUser linkWithCredential:credential
                                    ^
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:33:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRUser.h:334:71: note: 'linkWithCredential:completion:' has been explicitly marked deprecated here
                    completion:(nullable FIRAuthResultCallback)completion DEPRECATED_MSG_ATTRIBUTE(
                                                                          ^
    In module 'Darwin' imported from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterViewController.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/AvailabilityMacros.h:178:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
                #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
                                                                   ^
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:162:33: warning: 'linkWithCredential:completion:' is deprecated: Please use linkAndRetrieveDataWithCredential:completion: for Objective-C or linkAndRetrieveData(WithCredential:completion:) for Swift instead. [-Wdeprecated-declarations]
        [[FIRAuth auth].currentUser linkWithCredential:credential
                                    ^
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:33:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRUser.h:334:71: note: 'linkWithCredential:completion:' has been explicitly marked deprecated here
                    completion:(nullable FIRAuthResultCallback)completion DEPRECATED_MSG_ATTRIBUTE(
                                                                          ^
    In module 'Darwin' imported from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterViewController.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/AvailabilityMacros.h:178:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
                #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
                                                                   ^
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:169:33: warning: 'linkWithCredential:completion:' is deprecated: Please use linkAndRetrieveDataWithCredential:completion: for Objective-C or linkAndRetrieveData(WithCredential:completion:) for Swift instead. [-Wdeprecated-declarations]
        [[FIRAuth auth].currentUser linkWithCredential:credential
                                    ^
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:33:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRUser.h:334:71: note: 'linkWithCredential:completion:' has been explicitly marked deprecated here
                    completion:(nullable FIRAuthResultCallback)completion DEPRECATED_MSG_ATTRIBUTE(
                                                                          ^
    In module 'Darwin' imported from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Public/Flutter/Flutter/FlutterViewController.h:9:
    /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/usr/include/AvailabilityMacros.h:178:64: note: expanded from macro 'DEPRECATED_MSG_ATTRIBUTE'
                #define DEPRECATED_MSG_ATTRIBUTE(s) __attribute__((deprecated(s)))
                                                                   ^
    /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:187:43: error: incompatible block pointer types sending 'void (^)(FIRUser *__strong, NSError *__strong)' to parameter of type 'FIRAuthDataResultCallback _Nullable' (aka 'void (^)(FIRAuthDataResult * _Nullable __strong, NSError * _Nullable __strong)')
                                   completion:^(FIRUser *user, NSError *error) {
                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.m:5:
    In file included from /usr/local/numo/flutter/v0.5.1/.pub-cache/hosted/pub.dartlang.org/firebase_auth-0.5.9/ios/Classes/FirebaseAuthPlugin.h:7:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/Firebase/Firebase.h:18:
    In file included from /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FirebaseAuth.h:21:
    /Users/doug/work/sandbox/flutter_architecture_samples/example/simple_bloc_flutter/ios/Pods/Headers/Private/FirebaseAuth/FIRAuth.h:557:67: note: passing argument to parameter 'completion' here
                       completion:(nullable FIRAuthDataResultCallback)completion;
                                                                      ^
    10 warnings and 4 errors generated.

Flutter doctor output:

/usr/local/numo/flutter/latest/bin/flutter --no-color doctor
Doctor summary (to see all details, run flutter doctor -v):
[βœ“] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.6 17G65, locale en-US)
[βœ“] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[βœ“] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
[βœ“] Android Studio (version 3.1)
    βœ— Flutter plugin not installed; this adds Flutter specific functionality.
    βœ— Dart plugin not installed; this adds Dart specific functionality.
[βœ“] IntelliJ IDEA Ultimate Edition (version 2018.1)
[βœ“] Connected devices (1 available)

β€’ No issues found!

Navigation as a result of action in redux/built_redux pattern

Hi, I'm wondering how should I implement the case when the screen should change as a result of some action -- say to swap LoginPage to HomePage. Successful login would be an action, so I would either push route in middleware (I don't have the context, though) or somehow put the route in app state, but then I'd be just swapping widgets in store connection, not actually pushing new routes with the navigator.

Overall how should navigation triggered by the actions be handled (as opposed to navigation happening as a result of user interaction)?

Application state is set outside of the Redux Store, specifically navigation route

Is there a practical method to add route/navigation to the Redux AppState? In the redux example of this repo, DetailsScreen in detail_screen.dart and HomeScreen in home_screen.dart, both presentations components, are setting the state of the app via the Navigator. I am trying to figure out a way to include the route in the AppState and then implement subsequent routes outside presentation components, possibly through Middleware. I have failed thus far. :(

Much like the app presents the active tab via the store, I think the app should present the route via the store. Is this reasonable?

BTW - thanks so very much for this repo, it has been a great help to me getting off the ground with Flutter, Redux, and Dart.

How to Update Model in Built_redux ?

I still don't understand how to use this one ?

for example.. I add date value in Todo Model.


  factory Todo(String task) {
    return _$Todo._(
      task: task,
      complete: false,
      note: '',
      date: '',
      id: Uuid().generateV4(),
    );
  }

  factory Todo.builder([updates(TodoBuilder b)]) {
    final builder = TodoBuilder()
      ..id = Uuid().generateV4()
      ..complete = false
      ..note = ''
      ..date = ''
      ..update(updates);

    return builder.build();
  }



But I got this

The named parameter 'date' isn't defined.
The setter 'date' isn't defined for the class 'TodoBuilder'.
Missing concrete implementation of getter 'Todo.date'.

**I read that it has something to do with built_value

but I already run this on my terminal after editting the code and while running the app on my Phone**

flutter packages pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 338ms

How to properly setup the workspace, so the file with *.g.dart extension can be updated as soon as I develop the project ?

Which is more performant ? Built_Redux or flutter_redux ?

As you said in Reddit

Update to my own post -- I've built a more complex example using both Redux and built_redux, and I have to say they're almost identical, especially if you were to use built_value for your State and Action classes.
A more detailed comparison can be found here:

Which is better in terms of software performance ? with Built_value or without Built_value ?

Todo Redux Performance

In the todo app using Redux every time one of the todo items changes all the items get rebuilt.

How do I know that?
I added a print in todo_item.dart:27.

That means if there are 100 items in the list and one of them gets completed all the others will rebuild their widget. This is not the behaviour using StatefullWidgets.

To me (and I'm new to Flutter world) this feels like a major performance issue.

Questions:

  1. Am I correct?
  2. Is there a way to fix this?

For example is there a way to build a widget in answer to a certain action. Or ignore rebuild if certain action is dispatched?

Open different sample apps separately

How do you get to open each different sample application separately in an IDE, apparently they are tightly coupled and it's almost impossible for me to open each sample separately so that I can focus on learning source code of one sample at a time.

One project importing packages from an outside different project, that coupling makes it very hard to study the different architectures proposed here.

There are multiple heroes that share the same tag within a subtree

hi,I'm getting this error when i put same todos titles,in this example i put "redux".
after make 2 same title,I click add new todo.and screen goes blank.
tested with redux example,and scoped_model example.

Flutter (Channel beta, v0.3.1, on Mac OS X 10.13.4 17E199, locale en-MY)

I/flutter (17873): ══║ EXCEPTION CAUGHT BY SCHEDULER LIBRARY β•žβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
I/flutter (17873): The following assertion was thrown during a scheduler callback:
I/flutter (17873): There are multiple heroes that share the same tag within a subtree.
I/flutter (17873): Within each subtree for which heroes are to be animated (typically a PageRoute subtree), each Hero
I/flutter (17873): must have a unique non-null tag.
I/flutter (17873): In this case, multiple heroes had the following tag: redux__heroTag
I/flutter (17873): Here is the subtree for one of the offending heroes:
I/flutter (17873): # Hero(tag: redux__heroTag, state: _HeroState#88550)
I/flutter (17873): # β””KeyedSubtree-[GlobalKey#3373c]
I/flutter (17873): # β””Container(constraints: BoxConstraints(w=353.9, 0.0<=h<=Infinity))
I/flutter (17873): # β””ConstrainedBox(BoxConstraints(w=353.9, 0.0<=h<=Infinity), renderObject: RenderConstrainedBox#03eb3 relayoutBoundary=up16)
I/flutter (17873): # β””Text-[<'TodoItem__62c2aff3-f261-464a-b5db-ed29ebd90cdf__Task'>]("redux", debugLabel: (englishLike title).merge(whiteMountainView title), inherit: false, color: Color(0xffffffff), family: Roboto, size: 20.0, weight: 500, baseline: alphabetic, decoration: TextDecoration.none)
I/flutter (17873): # β””RichText(softWrap: wrapping at box width, textScaleFactor: 0.9, maxLines: unlimited, text: "redux", renderObject: RenderParagraph#dfa27 relayoutBoundary=up17)

Moar Widget Tests

Widget tests aren't well covered yet, should have more demonstrations of how to use this:

  • Mocking the repository and making sure it's being called
  • Container Widgets
  • UI Widgets

How to integrate navigation in a Redux application

I am doing this on my login screen. Is this a sane way of doing navigation?

  onPressed: () {
                          _once = store.onChange.listen((state) {
                             _once.cancel();
                            if (state.navigation == Navigation.home) {
                              Navigator.of(context).pushNamed('');
                            }
                          });

                          store.dispatch(new LoginAction(
                              username: _emailKey.currentState.value,
                              password: _passwordKey.currentState.value));
                        },

Getting error on pub get in built_redux package

`Running "flutter packages get" in built_redux...
Package build_runner has no versions that match >=0.5.0 <0.6.0 derived from:

  • built_redux_sample depends on version ^0.5.0
    pub get failed (1)
    Process finished with exit code 1`

This is the error I get. I am on 0.1.4 flutter and the latest on this repository.

What could be the issue. Using IntelliJ

Where to put data cache logic?

Regarding Redux architecture (in my case I'm using Epics).

Suppose that you've written an epic that does some pretty expensive work. you'd like to let the app use the cached result to a certain extent. Given that it's important to have things be pure functions, where have you found it appropriate to cache state and prevent the client from requesting repeated resources etc? I can see that from my epic I have access to the store, I could find a state flag that tells me the last time I updated this expensive resource and decline to fetch an update if a condition is not met. I could pass the responsibility to be a good citizen down to view consumers but that seems too much responsibility in too many places.

Put another way: If I kick off an action during the init function of my connected widget, and that is handled by an Epic that does expensive work, what's the best way to optimize so that expensive work isn't being done every time my widget gets initialized?

what are your thoughts?

How to run app

Hi Brian. I'm pretty new to Flutter and I think this repo is a great source. However I can't get it to compile and run on an emulator. Could you provide guidance on how to do that? I'm using android studio and flutter packages get crashes on the top level flutter_architecture_samples folder. Inner folders can compile but fail at runtime.

Scoped model: is it bad to call Model.notifyListeners "unnecessarily"?

Assume I have a Model class with 10 properties each calling notifyListeners in their setter method. Model class has also an Update method which updates all those properties triggering 10 subsequent notifyListeners calls.

Then I use the Model class in a Widget tree which references only one of the Model properties. Therefore calling Update method causes 9 unnecessary updates to the Widget tree.

Is this a real issue I should pay attention to or can I ignore this due to e.g. some Flutter optimization?

Redux example: filter button invisible, but still enabled

Appbar filter button on Stats page is invisible by design, yet still responsive.

filter_button.dart (a possible remedy):

    return IgnorePointer(
      ignoring: !visible,
      child: AnimatedOpacity(
        opacity: visible ? 1.0 : 0.0,
...
      ),
    );

I am not sure this is the best solution, but it works.

[Redux] Can't get dropdown to work properly on Statelesswidget

I using redux for flutter so every presentation is stateless but i can't get dropdown menu to work property since i can't change it's state to trigger flutter to rebuild the dropdown part when choose value from dropdown.

I trying to implement dropdown menu for this screen.

My code look something like this:

List<String> _suppliers = <String>['Apple', 'Google'];
  String _supplier = 'Apple';

DropdownButton(
                  key: _supplierKey,
                  value: _supplier,
                  items: _suppliers.map((String value) {
                    return new DropdownMenuItem<String>(
                      value: value,
                      child: new Text(value),
                    );
                  }).toList(),
                  onChanged: (String newValue) {
                    _supplier = newValue;
                  }),

I don't know if i implemented it right or anyway to workaround? Any help would be appreciate. Thanks you.

Update built_redux example when Dart 2 version is stable

I am having an issue with the build_redux example, in getting the build_runner to run in the project.

flutter_built_redux

The app runs fine, and I can see the code, and how its implemented, but I was hoping to learn about the different built components by using the project.

I have a number of projects working locally with built_value and built_collections - trying to find the right configuration to move into the built_redux/flutter_built_redux world.

Really just a working project with the requisite packages/version (pubspec.yaml) and build_runner working would be a great step - I was hoping these examples might be a start.

Add "App Flow" comments to code

I've gotten feedback that this library, asking for more comments within the code demonstrating the flow of these apps.

  • vanilla
  • redux
  • built_redux
  • inherited_widget
  • scoped_model

Example from Scott Stoll:

import "1_main.dart";
import '5_MyInheritedWidget.dart';
import '6_MiddleWidget.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';

/*Brian,
Use the TODOs to follow the logic of how this code flows. Hopefully you'll
agree that this explains what's going on here clearly enough that a 5 year old
could follow it. "Explain it to me like I'm 5" is a great way to go when
trying to teach someone things for their very first time. There are more notes
at the bottom of the page, after you're done.*/

class BaseStatefulWidgetState extends State<BaseStatefulWidget> with WidgetsBindingObserver {
  // TODO (1) var "name" will store the current name during rebuild, much like "Saved Instance State" would in Android
  // TODO (6) Store the new name here, then go rebuild
  String name = '..loading';

  static const int _NUMBER_OF_USERS = 10;

  // TODO (2) 'i' is used to track which record we want within the JSON data
  int i = 0;

  onTap() {
    // TODO: (3) User has tapped. Incrementing i tells us which name to get from the JSON data next (1st, 2nd, etc.).
    i++;
    _getName();
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState appLifecycleState) {
  }

  _getName() async {
    // TODO (4) Start async task for JSON operation. Fetch data & get name for record number 'i'
    var res = await http.get('https://jsonplaceholder.typicode.com/users');
    var name = JSON.decode(res.body)[i % _NUMBER_OF_USERS]['name'];

    // TODO (5) Send the name value of the above record to the global var "name" and trigger setState
    setState(() => this.name = name);
  }

  @override
  void initState() {
    super.initState();
    _getName();
    WidgetsBinding.instance.addObserver(this);
  }

  @override
  void dispose() {
    WidgetsBinding.instance.removeObserver(this);
    super.dispose();
  }

  @override
  void didChangeDependencies() {
    super.didChangeDependencies();
  }

  @override
  Widget build(BuildContext context) {

    // TODO (6) Notice that MyInheritedWidget is built / rebuilt with the current global name value.
    return new MyInheritedWidget(

      // TODO (7) MyInheritedWidget has the child MiddleWidget, so the UI widgets are going to be children of MyInheritedWidget
        name: name, onTap: onTap, child: const MiddleWidget());
  }
  /*From here the code leaves this class and goes to another class that builds the rest of the UI,
  including a text field that contains the updated name. The overall point is that, when dealing with a file
  people are supposed to be learning from, we really want to idiot proof the explaination of how the code
  flows.It's only when people understand the overall structure and how it flows that they'll be able to
  go on and implement it in their own creations. By using a TODO list, the student can move from step
  to step with a simple mouse click.

  Of course, in the working world, code that people are not trying to learn from should merely be expressive
  enough that people who are already familiar with the SDK will be able to follow.*/
}

built_redux example - store check point & rollback approach

Hi, I have a large app and I'm considering rewriting it and going down the built_redux route.

One of the things that I need is to undo changes made to multiple models in the store. Something like a checkpoint and then rollback to that check point. One approach could be to keep a store history from the check point onwards but I am not sure how to go about it since this is like implementing a higher level store.

I was wandering if you had any thoughts/ideas/pointers on this.

Regards,
Adam

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.