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
import 'dart:math'; typedef MapPoint = Point<int>; class MapPointJsonConverter extends JsonConverter<MapPoint, String> { const MapPointJsonConverter(); @override MapPoint fromJson(String json) => parseMapPoint(json); @override String toJson(MapPoint object) => '${object.x}x${object.y}'; }
import 'package:json_serializable/json_serializable.dart'; import 'package:fast_immutable_collections/fast_immutable_collections.dart'; part 'entity.g.dart'; @JsonSerializable(converters: [MapPointJsonConverter()]) class Entity { const Entity({required this.map}); factory Entity.fromJson(Map<String, dynamic> json) => _$EntityFromJson(json); final IMap<MapPoint, int> map; }
Entity _$EntityFromJson(Map<String, dynamic> json) => Entity( map: json['map'] == null ? const IMap.empty() : IMap<Point<int>, int>.fromJson( json['map'] as Map<String, dynamic>, (value) => const MapPointJsonConverter().fromJson(value as String), (value) => (value as num).toInt(), );
Unhandled Exception: Unsupported operation: JSON deserialization of IMap keys of type Point<int> are not supported at the moment.
#0 _safeKeyFromJson (package:fast_immutable_collections/src/imap/imap.dart:1558:5) #1 new IMap.fromJson.<anonymous closure> (package:fast_immutable_collections/src/imap/imap.dart:498:50) #2 MapBase.map (dart:collection/maps.dart:82:28) #3 new IMap.fromJson (package:fast_immutable_collections/src/imap/imap.dart:497:12)
The text was updated successfully, but these errors were encountered:
Related to:
#39 #58
Sorry, something went wrong.
No branches or pull requests
map_point.dart
entity.dart
entity.g.dart
error
stack trace
The text was updated successfully, but these errors were encountered: