Google celebrates Hispanic Heritage Month. See how.

ComponentContext.create constructor

*[<Null safety>](*


Creates the component context. Users need to make sure that they call serve after they have finished adding all their public services.

Note: ComponentContext can only be constructed once.


Future<void> main() async {
  final context = ComponentContext.create();
  await doAsyncSetup();


factory ComponentContext.create() {
  if (_componentContext != null) {
    throw Exception(
        'Attempted to construct ComponentContext multiple times. Ensure that the existing ComponentContext is reused instead of constructing multiple instances.');
  return _componentContext = ComponentContext(
    svc: Platform.isFuchsia ? Incoming.fromSvcPath() : Incoming(),
    outgoing: Outgoing(),