@@ -14,18 +14,18 @@ extension ObjectExt on Object? {
1414 if (value is R ) return value;
1515
1616 return switch (R ) {
17- String =>
17+ const ( String ) =>
1818 (value is List || value is Map ? jsonEncode (value) : value.toString ())
1919 .tryCast <R >() ??
2020 defaultValue,
21- int => value.toInt ().tryCast <R >() ?? defaultValue,
22- double => value.toDouble ().tryCast <R >() ?? defaultValue,
23- num => value.toNum ().tryCast <R >() ?? defaultValue,
24- bool => value.toBool ().tryCast <R >() ?? defaultValue,
25- ColorRGBA => value.toColorRGBA ().tryCast <R >() ?? defaultValue,
26- ColorRGB => ColorRGB .fromColorRGBA (value.toColorRGBA ()).tryCast <R >() ??
21+ const ( int ) => value.toInt ().tryCast <R >() ?? defaultValue,
22+ const ( double ) => value.toDouble ().tryCast <R >() ?? defaultValue,
23+ const ( num ) => value.toNum ().tryCast <R >() ?? defaultValue,
24+ const ( bool ) => value.toBool ().tryCast <R >() ?? defaultValue,
25+ const ( ColorRGBA ) => value.toColorRGBA ().tryCast <R >() ?? defaultValue,
26+ const ( ColorRGB ) => ColorRGB .fromColorRGBA (value.toColorRGBA ()).tryCast <R >() ??
2727 defaultValue,
28- PaintModel => value.toColorRGBA ()? .toPaint ().tryCast <R >() ?? defaultValue,
28+ const ( PaintModel ) => value.toColorRGBA ()? .toPaint ().tryCast <R >() ?? defaultValue,
2929 _ when R .isMap => value.toMap ().tryCast <R >(),
3030 _ when R .isList || R .isIterable => value.toList <R >(),
3131 _ when R .isSet => value.toSet <R >(),
0 commit comments