update method

  1. @override
Future<bool> update([
  1. void runAndTrackSideEffects()?
])
inherited

Returns a future that completes after processing DOM update events.

If true is returned, calling update again may be required to get to a completely stable state. See NgTestStabilizer.stabilize.

runAndTrackSideEffects may optionally be specified:

@override
Future<bool> update([void fn()]) async {
  // Track the results of running fn, which may spawn async events.
  _zone.run(fn);

  // Now wait until we know those events are done.
  await _waitUntilZoneStable();
  return true;
}

Implementation

@override
Future<bool> update([
  void Function()? runAndTrackSideEffects,
]) {
  // Future.sync() ensures that any errors thrown by `runAndTrackSideEffects`
  // are propagated through the returned Future instead of being thrown
  // synchronously.
  return Future<void>.sync(() {
    _triggerSideEffects(runAndTrackSideEffects ?? _noSideEffects);
    return _waitForAsyncEventsOrErrors();
  }).then((_) => isStable);
}