addPostBuildCallback method

  1. @override
  2. @nonVirtual
void addPostBuildCallback(
  1. void callback()
)
override

Registers callback to be called after the current build.

This method should only be called from implementations of HookState. This method can only be called during build of this HookContext, otherwise an exception will be thrown. The callbacks will be called in the order they were registered.

Implementation

@override
@nonVirtual
void addPostBuildCallback(void Function() callback) {
  assert(() {
    if (!debugDoingBuild) {
      throw FlutterError.fromParts([
        ErrorSummary("addPostBuildCallback can only be called during build"),
        DiagnosticableTreeNode(name: "context", value: this, style: null),
      ]);
    }
    return true;
  }());
  _postBuildCallbacks.add(callback);
}