foldFuture<TR, T> method

Future<TR> foldFuture<TR, T>(
  1. Future<TR> noneF(),
  2. Future<TR> someF(
    1. T val
    )
)

Implementation

Future<TR> foldFuture<TR, T>(
    Future<TR> Function() noneF, Future<TR> Function(T val) someF) {
  return then((value) => value.fold(() => noneF().then((value) => value),
      (val) => someF(val).then((value) => value)));
}