afMainApp function

void afMainApp({
  1. required AFDartParams paramsDart,
  2. AFExtendBaseDelegate? installBase,
  3. AFExtendBaseDelegate? installBaseLibrary,
  4. required AFExtendAppDelegate installCoreApp,
  5. AFExtendLibraryUIDelegate? installCoreLibrary,
  6. required AFExtendTestDelegate installTest,
  7. AFAppExtensionContext? appContext,
})

afMainApp handles startup, execution, and shutdown sequence for an afApp

Implementation

void afMainApp({
  required AFDartParams paramsDart,
  AFExtendBaseDelegate? installBase,
  AFExtendBaseDelegate? installBaseLibrary,
  required AFExtendAppDelegate installCoreApp,
  AFExtendLibraryUIDelegate? installCoreLibrary,
  required AFExtendTestDelegate installTest,
  AFAppExtensionContext? appContext,
}) {
  final baseContext = AFBaseExtensionContext();
  if(installBase != null) {
    installBase(baseContext);
  }
  if(installBaseLibrary != null) {
    installBaseLibrary(baseContext);
  }
  AFibD.initialize(paramsDart);

  final context = appContext ?? AFibF.context;


  installCoreApp(context);
  installTest(context.test);
  if(installCoreLibrary != null) {
    installCoreLibrary(context.thirdParty);
  }


  AFibF.initialize(context, AFConceptualStore.appStore);

  final createApp = AFibF.g.createApp;
  if(createApp == null) throw AFException("Missing create app function");
  final app = createApp();
  app.afBeforeRunApp();
  runApp(app);
  app.afAfterRunApp();

}