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

Identifiable mixin and id-based collection helpers for Dart.

Identifiable #

Identifiable mixin and id-based collection helpers for Dart.

Usage #

import 'package:identifiable/identifiable.dart';

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

  @override
  final String id;
}

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

  // Iterable helpers
  users.byId('a');             // User?
  users.withoutId('a');        // Iterable<User>
  var map = users.toMapById(); // Map<String, User> keyed by id

  // Map helpers — immutable; each returns a new map
  map = map.upsert(User('c'));
  map = map.removeById('a');
  map = map.updateById('b', (u) => u);
}
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