weak_map 1.0.5 weak_map: ^1.0.5 copied to clipboard
WeakMap is a map of key/value pairs in which the keys are weakly referenced. WeakContainer is a weak-reference that only lets you check if some object it the same you had before.
import 'package:weak_map/weak_map.dart';
void main() {
var map = WeakMap();
map["A"] = 1;
print('A = ${map["A"]}'); // A = 1
print('B = ${map["B"]}'); // B = null
var value = WeakContainer("X");
print('Contains X = ${value.contains("X")}'); // Contains X = true
print('Contains Y = ${value.contains("Y")}'); // Contains Y = false
}