identifiable 0.2.0 copy "identifiable: ^0.2.0" to clipboard
identifiable: ^0.2.0 copied to clipboard

Identifiable mixin and id-based collection helpers for Dart.

example/identifiable_example.dart

import 'package:identifiable/identifiable.dart';

class User with Identifiable {
  User(this.id);

  @override
  final String id;
}

void main() {
  final users = [User('a'), User('b')];

  var byId = users.toMapById(); // {'a': ..., 'b': ...}
  byId = byId.upsert(User('c')); // add/replace by id
  byId = byId.removeById('a'); // drop by id

  print(byId.keys); // (b, c)
}
1
likes
0
points
642
downloads

Publisher

unverified uploader

Weekly Downloads

Identifiable mixin and id-based collection helpers for Dart.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on identifiable