veilidchat/packages/veilid_support/lib/src/output.dart
2024-05-13 10:03:25 -04:00

34 lines
736 B
Dart

import 'package:fast_immutable_collections/fast_immutable_collections.dart';
export 'package:fast_immutable_collections/fast_immutable_collections.dart'
show Output;
extension OutputNullExt<T> on Output<T>? {
void mapSave<S>(Output<S>? other, T Function(S output) closure) {
if (this == null) {
return;
}
if (other == null) {
return;
}
final v = other.value;
if (v == null) {
return;
}
return this!.save(closure(v));
}
}
extension OutputExt<T> on Output<T> {
void mapSave<S>(Output<S>? other, T Function(S output) closure) {
if (other == null) {
return;
}
final v = other.value;
if (v == null) {
return;
}
return save(closure(v));
}
}