Created
April 10, 2024 19:21
-
-
Save fredgrott/98759166caa008178cc91480b07f2a5a to your computer and use it in GitHub Desktop.
json dynamic casting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Container extends Coding { | |
List<String> things; | |
@override | |
Map<String, cast.Cast<dynamic>> get castMap => { | |
"things": cast.List(cast.String) | |
}; | |
@override | |
void decode(KeyedArchive object) { | |
super.decode(object); | |
things = object.decode("things"); | |
} | |
@override | |
void encode(KeyedArchive object) { | |
object.encode("things", things); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment