ctx 0.0.2 copy "ctx: ^0.0.2" to clipboard
ctx: ^0.0.2 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
}
0
likes
160
points
370
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Immutable context for carrying data through an application.

Repository (GitHub)
View/report issues

License

MIT (license)

More

Packages that depend on ctx