zone_local 0.1.2 zone_local: ^0.1.2 copied to clipboard
A simple package for defining zone-scoped values. Typically used for configuration objects.
import 'package:zone_local/zone_local.dart';
final ZoneLocal<String> greeting = ZoneLocal<String>(defaultValue: 'Hello!');
void main() {
print(greeting.value);
// Run a function in a forked zone that sees value "Hi!"
greeting.forkZoneWithValue('Hi!').run(() {
print(greeting.value);
});
}