createViewFactory function

Statement createViewFactory(
  1. CompileView view,
  2. ClassStmt viewClass
)

Creates a factory function that instantiates a view.

AppView<SomeComponent> viewFactory_SomeComponentHost0() {
  return ViewSomeComponentHost0();
}

Implementation

o.Statement createViewFactory(CompileView view, o.ClassStmt viewClass) {
  switch (view.viewType) {
    case ViewType.embedded:
      return _createEmbeddedViewFactory(view, viewClass);
    case ViewType.host:
      return _createHostViewFactory(view, viewClass);
    default:
      throw StateError(
          'Can\'t create factory for view type "${view.viewType}"');
  }
}