Nesting
import 'package:scope/scope.dart';
void main() {
// parent scope
Scope()
..value<String>(greetingKey, 'Hello')
..value<int>(emphasisKey, 1)
..run(() {
/// Nest child Scope (1)
Scope()
..value<String>(greetingKey, 'Good day')
..run(() {
Greeter().greet('Philipp'); // 'Good day, Philipp!'
});
/// Sibling of (1) = also nested witin the parent scope
Scope()
..value<int>(emphasisKey, 3)
..run(() {
Greeter().greet('Paul'); // 'Hello, Paul!!!'
});
});
}Last updated