easy_entry 1.0.1 copy "easy_entry: ^1.0.1" to clipboard
easy_entry: ^1.0.1 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
36
downloads

Publisher

unverified uploader

Weekly Downloads

2024.09.13 - 2025.03.28

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on easy_entry