Scope
import 'package:scope/scope.dart';
/// create a key to access a scoped value
final ageKey = ScopeKey<int>();
void main() {
/// create a Scope
Scope()
/// inject a value
..value<int>(ageKey, 18)
/// run some code within the Scope
..run(() => a();
}
void a() => b();
/// `use` the injected value by its key 'ageKey'
void b() => print('You are ${use(ageKey)} years old');Last updated