ctx 0.0.2
ctx: ^0.0.2 copied to clipboard
Immutable context for carrying data through an application.
ctx #
An immutable context for carrying data through your application.
Usage #
import 'package:ctx/ctx.dart';
void main() {
final ctx = 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
}