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
If json_serializable is used with IMap a Type error occurs when string is converted in the into bool / int/ double (num) or duration (FromJson). However DateTime, BigInt or Uri for example are parsed as expected.
FromJson
Looking to the generated code some types are not parsed correctly with the function FromJson:
Type error
IMap<X, String>.fromJson
X = int: (value) => value as bool,
X = bool: (value) => value as bool,
X double: (value) => (value as num).toDouble(),
Works good
IMap<X, String>.fromJson
X: (value) => DateTime.parse(value as String),
X: (value) => BigInt.parse(value as String),
ToJson
I do not known if it is necessary, but not everything is converted to string:
Not converted to string (problem?):
double/int/bool: (value) => value (Should this not be a String?)
Hi,
If json_serializable is used with IMap a Type error occurs when string is converted in the into bool / int/ double (num) or duration (FromJson). However DateTime, BigInt or Uri for example are parsed as expected.
json_serializable: ^6.7.0
fast_immutable_collections: ^9.1.5
FromJson
Looking to the generated code some types are not parsed correctly with the function FromJson:
Type error
IMap<X, String>.fromJson
X = int: (value) => value as bool,
X = bool: (value) => value as bool,
X double: (value) => (value as num).toDouble(),
Works good
IMap<X, String>.fromJson
X: (value) => DateTime.parse(value as String),
X: (value) => BigInt.parse(value as String),
ToJson
I do not known if it is necessary, but not everything is converted to string:
Not converted to string (problem?):
double/int/bool: (value) => value (Should this not be a String?)
Converted to string (works good)
DateTime: (value) => value.toIso8601String()
BigInt: (value) => value.toString(),
If this is resolved, I can resolve marcglasberg/fast_immutable_collections#58.
Thank you.
Example
SerializableExample
Generator code
The text was updated successfully, but these errors were encountered: