newAppBar function

Future<AppBarModel> newAppBar(
  1. String appId, {
  2. bool? store,
})

Implementation

Future<AppBarModel> newAppBar(String appId, {bool? store}) async {
  var appBarId = appBarID(appId);
  var menuDefModel = await menuDefRepository(appId: appId)!.get(appBarId);
  if (menuDefModel == null) {
    menuDefModel = newMenuDef(appId, appBarId);
    await menuDefRepository(appId: appId)!.add(menuDefModel);
  }
  var appBarModel = AppBarModel(
      documentID: appBarId,
      appId: appId,
      header: HeaderSelection.title,
      iconMenu: menuDefModel);
  if ((store != null) && (store)) {
    await appBarRepository(appId: appId)!.add(appBarModel);
  }
  return appBarModel;
}