Skip to content

Commit

Permalink
Rename JSON deserializer functions
Browse files Browse the repository at this point in the history
This keeps json_serializable happy, as it checks the name
of additional methods provided to the `fromJson` factory[^1].

[^1]: google/json_serializable.dart#870
  • Loading branch information
borgoat committed Nov 1, 2023
1 parent 1d59d44 commit 23d0336
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/src/entity_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ class EntityState<T> {

factory EntityState.fromJson(
Map<String, dynamic> json,
Deserializer<T> deserializer,
Deserializer<T> fromJsonT,
) =>
EntityState(
entities: (json['entities'] as Map<String, dynamic>).map(
(key, props) => MapEntry<String, T>(key, deserializer(props)),
(key, props) => MapEntry<String, T>(key, fromJsonT(props)),
),
ids: List<String>.from(json['ids']));
}
4 changes: 2 additions & 2 deletions lib/src/remote_entity_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ class RemoteEntityState<T> extends EntityState<T> {

factory RemoteEntityState.fromJson(
Map<String, dynamic> json,
Deserializer<T> deserializer,
Deserializer<T> fromJsonT,
) =>
RemoteEntityState(
entities: (json['entities']).map<String, T>(
(key, props) => MapEntry<String, T>(key, deserializer(props)),
(key, props) => MapEntry<String, T>(key, fromJsonT(props)),
) ??
{},
ids: json['ids'] != null ? List<String>.from(json['ids']) : [],
Expand Down

0 comments on commit 23d0336

Please sign in to comment.