File tree Expand file tree Collapse file tree
packages/dart_mappable/lib/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,9 +103,13 @@ abstract class MapperContainer {
103103 PrimitiveMapper <Object >((v) => v, dynamic ),
104104 PrimitiveMapper <Object >((v) => v, Object ),
105105 PrimitiveMapper <String >((v) => v.toString ()),
106- PrimitiveMapper <int >((v) => num .parse (v.toString ()).round ()),
107- PrimitiveMapper <double >((v) => double .parse (v.toString ())),
108- PrimitiveMapper <num >((v) => num .parse (v.toString ()), num ),
106+ PrimitiveMapper <int >(
107+ (v) => v is num ? v.round () : num .parse (v.toString ()).round (),
108+ ),
109+ PrimitiveMapper <double >(
110+ (v) => v is num ? v.toDouble () : double .parse (v.toString ()),
111+ ),
112+ PrimitiveMapper <num >((v) => v is num ? v : num .parse (v.toString ()), num ),
109113 PrimitiveMapper <bool >((v) => v is num ? v != 0 : v.toString () == 'true' ),
110114 DateTimeMapper (),
111115 IterableMapper <List >(< T > (i) => i.toList (), < T > (f) => f <List <T >>()),
You can’t perform that action at this time.
0 commit comments