zone_local 0.2.0-nullsafety.1 copy "zone_local: ^0.2.0-nullsafety.1" to clipboard
zone_local: ^0.2.0-nullsafety.1 copied to clipboard

discontinued
outdated

A simple, type-safe package for declaring static variables (for configuration, etc.) that can have zone-scoped values.

example/zone_local.dart

import 'package:zone_local/zone_local.dart';
import 'dart:async';

final ZoneLocal<String> greeting = ZoneLocal<String>(defaultValue: 'Hello!');

void main() {
  print('In the default zone: ${greeting.value}');

  // Run a function in a forked zone that sees value "Hi!"
  final forkedZone = Zone.current.fork(zoneValues: {
    greeting.key: 'Hello',
  });

  forkedZone.run(() {
    print('In the forked zone: ${greeting.value}');
  });
  print('In the default zone: ${greeting.value}');
}
0
likes
110
pub points
6%
popularity

Publisher

unverified uploader

A simple, type-safe package for declaring static variables (for configuration, etc.) that can have zone-scoped values.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (LICENSE)

Dependencies

meta

More

Packages that depend on zone_local