then<R> method

NitroPromise<R> then<R>(
  1. R transform(
    1. T
    )
)

Synchronously transform the resolved value. Returns a new NitroPromise<R>. Mirrors Promise<T>::then<R>(fn) in RN Nitro.

Implementation

NitroPromise<R> then<R>(R Function(T) transform) {
  final next = NitroPromise<R>();
  _completer.future.then(
    (v) => next.resolve(transform(v)),
    onError: (e, s) => next.reject(e, s),
  );
  return next;
}