We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have this Freezed Class that I want to use for DataModel loaded from my Backend
@Freezed(genericArgumentFactories: true) class DataModel<T> with _$DataModel { factory DataModel({ required String id, required bool loading, required DateTime lastLoaded, required T? data, }) = _DataModel; factory DataModel.fromJson( Map<String, dynamic> json, T Function(Object?) fromJsonT, ) => _$DataModelFromJson(json, fromJsonT); }
This generates fine. Next Step Would be to use this class with my Data class and State class. Here a example Using my UserModel.
@freezed class User with _$User { factory CrUser({ required String id, required String fullName, required String email, }) = _User; factory User.fromJson(Map<String, dynamic> json) => _$UserFromJson(json); }
This also generates fine. But if i try to use it together with DataModel:
@freezed class UsersCubitState with _$UsersCubitState { const factory UsersCubitState({ required Map<String, DataModel<User>> users, }) = _UsersCubitState; const UsersCubitState._(); factory UsersCubitState.initial() => const UsersCubitState(users: {}); factory UsersCubitState.fromJson(Map<String, dynamic> json) => _$UsersCubitStateFromJson(json); }
I get following error:
[SEVERE] json_serializable on lib/features/users/cubit/users_cubit.dart: RangeError (index): Invalid value: Only valid value is 0: -1
I don't really know what do do with this error message...
Im I doing something wrong? If necessary I can provide a minimal repository to reproduce this error if needed.
Expected behavior I would expect to generate my Class without an error.
The text was updated successfully, but these errors were encountered:
Closing my Issue Found solution here #766
Sorry, something went wrong.
No branches or pull requests
I have this Freezed Class that I want to use for DataModel loaded from my Backend
This generates fine. Next Step Would be to use this class with my Data class and State class. Here a example Using my UserModel.
This also generates fine. But if i try to use it together with DataModel:
I get following error:
I don't really know what do do with this error message...
Im I doing something wrong? If necessary I can provide a minimal repository to reproduce this error if needed.
Expected behavior
I would expect to generate my Class without an error.
The text was updated successfully, but these errors were encountered: