You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The argument type '(#lib1::AppState, dynamic) → #lib1::AppState' can't be assigned to the parameter type '(#lib2::AppState, dynamic) → #lib2::AppState'.
#81
Closed
rob-nolan opened this issue
Sep 25, 2018
· 4 comments
I get the above compiler error when building my app, the error relates to the appReducer parameter in the Store instantiation in main.dart. I've searched and found people having similar issues, but in their case it was always caused by relative paths which I am not using.
I've gone through my code and the docs a number of times and I can't see anything wrong so I think it may be a bug but please correct me if I am missing something.
-main.dart-
class MainApp extends StatelessWidget {
final store = Store<AppState>(
appReducer,
initialState: new AppState(),
middleware: []
..addAll(createAuthMiddleware())
..add(new LoggingMiddleware.printer()),
);
.
.
.
-app_state.dart-
class AppState {
final User currentUser;
AppState({
this.currentUser,
});
AppState copyWith({User currentUser}) {
return new AppState(
currentUser: currentUser ?? this.currentUser,
);
}
@override
String toString() {
return 'AppState{currentUser: $currentUser}';
}
}
-auth_actions.dart-
class LogIn {}
class LogInSuccessful {
final User user;
LogInSuccessful({ @required this.user});
@override
String toString() {
return 'LogIn{user: $user}';
}
}
class LogInFail {
final dynamic error;
LogInFail(this.error);
@override
String toString() {
return 'LogIn{There was an error logging in: $error}';
}
}
class LogOut {}
class LogOutSuccessful {
LogOutSuccessful();
@override
String toString() {
return 'LogOut{user: null}';
}
}
hi there,
Just an observation, I'm doing a complex project, and I used redux, I've defined my actions as classes, and I never used 'dynamic' in my code in the reducers files.
For example:
And I did not have such problem.
I don't know if this can help solve your issue by defining classes for the actions that you are using, also this will make your code clearer.
i have issued this problem and i was trying about a whole day to solve it
change (import "package:flutter_redux/folder/filename.dart") .
to (import "folder/filename.dart")
I get the above compiler error when building my app, the error relates to the
appReducer
parameter in theStore
instantiation inmain.dart
. I've searched and found people having similar issues, but in their case it was always caused by relative paths which I am not using.I've gone through my code and the docs a number of times and I can't see anything wrong so I think it may be a bug but please correct me if I am missing something.
The text was updated successfully, but these errors were encountered: