removeValue<T> method
Puts a null value in the specified GadgetSubject
stored in the map.
If closeSubject
is true, the selected GadgetSubject
will be closed
and removed from the map.
If the specified GadgetSubject
is null, the method will throw an exception.
Implementation
void removeValue<T>({bool closeSubject = false, String? token}) {
final valueKey = toValueKey(T, token: token);
// ignore: close_sinks
GadgetSubject<T?>? subject = _subjectMap[valueKey] as GadgetSubject<T?>?;
if (subject == null) {
throw StateError('Tried to remove a value from an unexsisting subject.');
}
_removeFromSubject(subject, valueKey);
}