add static method
Add a stabilize function for a framework.
This function will be called whenever a test needs to wait for the framework to stabilize. When the framework is stable, it needs to call the IsStableCallback provided as an argument to the FrameworkStabilizer. Rules for calling the callback by the framework:
- If a framework is already stable at the time of callback
registration, the callback should be called in the next event loop
iteration with the
didWork
parameter set to false. - Otherwise, the callback should be called as soon as the framework is
stable with
didWork
set to true. - A registered callback should never be called more than once.
The id returned by add can be used to remove the FrameworkStabilizer with remove.
Implementation
static int add(FrameworkStabilizer fn) {
var wrappedFn = allowInterop(fn);
var id = _nextId++;
_idToFrameworkStabilizer[id] = wrappedFn;
_frameworkStabilizers.add(wrappedFn);
return id;
}