easy_entry 1.0.0 copy "easy_entry: ^1.0.0" to clipboard
easy_entry: ^1.0.0 copied to clipboard

A simple, readable and concise way to deal with modifying, inserting and removing Map entries in Dart.

example/easy_entry_example.dart

import 'package:easy_entry/easy_entry.dart';

void main() {
  final map = <int, List<String>>{
    10: ['Hello'],
  };

  final helloWorld = map
      .entry(10)
      .andModify((value) => value.add('World'))
      .retainIf((value) => value.length == 2)
      .orInsert(['Default']);

  print(helloWorld);

  final item = map
      .entry(20)
      .andModify((value) => value.remove('Something from the list'))
      .orNull;

  print(item);
}
copied to clipboard
3
likes
160
points
35
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.30 - 2025.04.14

A simple, readable and concise way to deal with modifying, inserting and removing Map entries in Dart.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

More

Packages that depend on easy_entry