swallowCancellation method

Future<T?> swallowCancellation()

future.swallowCancellation().maybeThen(doSomething)

Implementation

Future<T?> swallowCancellation() async {
  try {
    return await this;
  } catch (error) {
    if (error is CancellationException) {
      return null;
    }
    rethrow;
  }
}