blob: 84a1825f02efd526f7f529cba5664966d67ccafd [file] [log] [blame] [view]
# ComponentContext.createAndServe constructor
*[<Null safety>](https://dart.dev/null-safety)*
ComponentContext.createAndServe()
<p>Creates a ComponentContext and immediately serves the outgoing. This
method is useful for simple programs who do not have to do any complicated
setup.</p>
<p>Note: ComponentContext can only be constructed once.</p>
<p>Example:</p>
<pre class="language-dart"><code>void main() {
final context = ComponentContext.createAndServe();
...
}
</code></pre>
## Implementation
```dart
factory ComponentContext.createAndServe() {
return ComponentContext.create()..outgoing.serveFromStartupInfo();
}
```