diff --git a/lib/src/impl/type_registry.dart b/lib/src/impl/type_registry.dart index c8e0d7e8b..44bf0bc57 100644 --- a/lib/src/impl/type_registry.dart +++ b/lib/src/impl/type_registry.dart @@ -31,7 +31,7 @@ class _TypeRegistry { 'Type is not registered. Did you forget to register it?', ); } - if (json is Map) { + if (json is Map || json is List) { value = handler.fromJson(json); } else { throw ArgumentError('Type mismatch. Expected Map ' @@ -72,7 +72,7 @@ class _TypeRegistry { } } -T? _noop(Map json) { +T? _noop(dynamic json) { throw UnimplementedError(); } @@ -85,7 +85,7 @@ class _TypeHandler { final int? typeId; - final T? Function(Map json) fromJson; + final T? Function(dynamic json) fromJson; bool handlesValue(dynamic value) { return value is T;