Converts Result to Future
Future<D> toFuture() => when(ok: (data) => Future<D>.value(data), error: (error) => Future.error(error));