readPickleables<T> method
Reads a List
of Pickleables from this Pickle.
This will throw ArgumentError if the key is empty and no default value has been provided or PickleTypeError if the associated value is of a different type than expected.
Implementation
List<T> readPickleables<T>(
final String key,
final T Function(Pickle pickle) depickler, {
final List<T>? defaultValue,
}) {
try {
return _readList(key)
.map<T>((final Map<String, dynamic> map) => depickler(Pickle._(map)))
.toList();
} catch (error) {
if (defaultValue != null) {
return defaultValue;
}
rethrow;
}
}