Google is committed to advancing racial equity for Black communities. See how.

ComponentContext.createAndServe constructor

*[<Null safety>](https://dart.dev/null-safety)*

ComponentContext.createAndServe()

Creates a ComponentContext and immediately serves the outgoing. This method is useful for simple programs who do not have to do any complicated setup.

Note: ComponentContext can only be constructed once.

Example:

void main() {
  final context = ComponentContext.createAndServe();
  ...
}

Implementation

factory ComponentContext.createAndServe() {
  return ComponentContext.create()..outgoing.serveFromStartupInfo();
}