Skip to content

Instantly share code, notes, and snippets.

@icatalud
Last active September 7, 2019 17:40
Show Gist options
  • Save icatalud/121a1cb789a7d08c61f8a6f4d9a9cf37 to your computer and use it in GitHub Desktop.
Save icatalud/121a1cb789a7d08c61f8a6f4d9a9cf37 to your computer and use it in GitHub Desktop.
Using a static class as a port to `floop` Map
class DynamicValues {
static Widget get image => floop['image'];
static set image(Widget widget) => floop['image'] = widget;
// Here should go all the reads and writes to `floop`
}
/// It's also possible to create a local [ObservedMap].
/// `floop` is just an instance of [ObservedMap].
class DynamicValuesLocal {
static ObservedMap<String, dynamic> dyn = ObservedMap();
static Widget get image => dyn['image'];
static set image(Widget widget) => dyn['image'] = widget;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment