Favourites
This commit is contained in:
parent
6a84a9bef0
commit
1747ab0245
23 changed files with 469 additions and 67 deletions
|
@ -1,6 +1,17 @@
|
|||
import 'dart:collection';
|
||||
|
||||
extension MapExtensions<A, B> on Map<A, B> {
|
||||
Map<A, B> get deepCopy => {...this};
|
||||
|
||||
/// Returns the values of a [Map] at given [keys] indices.
|
||||
Iterable<B> valuesByKeys({required Iterable<A> keys}) => keys.map((final key) => this[key]!);
|
||||
}
|
||||
|
||||
extension LinkedHashMapExtensions<A, B> on LinkedHashMap<A, B> {
|
||||
/// Updated the value at [valueIndex] to [newValue], in addition to preserving the order.
|
||||
void updateValueAt({
|
||||
required int valueIndex,
|
||||
required B newValue,
|
||||
}) =>
|
||||
this[keys.toList()[valueIndex]] = newValue;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
extension ValueNotifierBoolExtensions on ValueNotifier<bool> {
|
||||
void flipValue() => value = !value;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue