ctx 0.0.1
ctx: ^0.0.1 copied to clipboard
Immutable context for carrying data through an application.
example/ctx_example.dart
import 'package:ctx/ctx.dart';
void main() {
final ctx = const Context.empty()
.withValue('user', 'alice')
.withValue('role', 'admin');
print(ctx['user']); // alice
// Derive a new context without mutating the original:
final scoped = ctx.withValue('role', 'editor');
print(ctx['role']); // admin
print(scoped['role']); // editor
}