getOrCreate method

Future<AppBarModel> getOrCreate()

Implementation

Future<AppBarModel> getOrCreate() async {
  var appBarModel =
      await appBarRepository(appId: app.documentID)!.get(identifier);
  if (appBarModel == null) {
    appBarModel = AppBarModel(
        documentID: identifier,
        appId: app.documentID,
        header: HeaderSelection.title,
        iconMenu: await menuDef());

    await appBarRepository(appId: app.documentID)!.add(appBarModel);
  }
  return appBarModel;
}