-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Trying to run this app with Dart 2 causes this
compiler message: lib/main.dart:14:17: Error: A value of type '(#lib1::TodoState, #lib2::TodoAction) → #lib1::TodoState' can't be assigned to a variable of type '(dynamic, dynamic) → dynamic'.
compiler message: Try changing the type of the left hand side, or casting the right hand side to '(dynamic, dynamic) → dynamic'.
compiler message: new Store(todoAppReducer, initialState: new TodoState.initialState());
compiler message: ^
[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
'file:///Users/miguel/Projects/flutter-redux-todo-list/lib/main.dart': error: line 14 pos 17: lib/main.dart:14:17: Error: A value of type '(#lib1::TodoState, #lib2::TodoAction) → #lib1::TodoState' can't be assigned to a variable of type '(dynamic, dynamic) → dynamic'.
Try changing the type of the left hand side, or casting the right hand side to '(dynamic, dynamic) → dynamic'.
new Store(todoAppReducer, initialState: new TodoState.initialState());
^
new Store(todoAppReducer, initialState: new TodoState.initialState());
^
#0 main (file:///Users/miguel/Projects/flutter-redux-todo-list/lib/main.dart:9:14)
#1 _startIsolate.<anonymous closure> (dart:isolate/isolate_patch.dart:279:19)
#2 _RawReceivePortImpl._handleMessage (dart:isolate/isolate_patch.dart:165:12)
I tried to solve it by replacing
final Store store = new Store>(todoAppReducer, initialState: new TodoState.initialState());
with
final Store store = new Store<TodoState>(todoAppReducer, initialState: new TodoState.initialState());
in main.dart
. But then I get this error:
[VERBOSE-2:dart_error.cc(16)] Unhandled exception:
'file:///Users/miguel/Projects/flutter-redux-todo-list/lib/main.dart': error: line 14 pos 28: lib/main.dart:14:28: Error: The top level function has type '(#lib1::TodoState, #lib2::TodoAction) → #lib1::TodoState' that isn't of expected type '(#lib1::TodoState, dynamic) → #lib1::TodoState'.
Change the type of the function or the context in which it is used.
new Store<TodoState>(todoAppReducer, initialState: new TodoState.initialState());
^
new Store<TodoState>(todoAppReducer, initialState: new TodoState.initialState());
^
#0 main (file:///Users/miguel/Projects/flutter-redux-todo-list/lib/main.dart:9:14)
#1 _startIsolate.<anonymous closure> (dart:isolate/isolate_patch.dart:279:19)
#2 _RawReceivePortImpl._handleMessage (dart:isolate/isolate_patch.dart:165:12)
Any idea on how to solve it?
user135711
Metadata
Metadata
Assignees
Labels
No labels