getOrCreate method

Future<DrawerModel> getOrCreate()

Implementation

Future<DrawerModel> getOrCreate() async {
  var drawerModel =
      await drawerRepository(appId: app.documentID)!.get(identifier);
  if (drawerModel == null) {
    drawerModel = DrawerModel(
        documentID: identifier,
        appId: app.documentID,
        name: 'Profile Drawer',
        headerText: '',
        secondHeaderText: 'name: \${userName}\ngroup: \${userGroup}',
        headerHeight: 0,
        popupMenuBackgroundColor: RgbModel(r: 255, g: 0, b: 0, opacity: 1.00),
        menu: await menuDef());

    await drawerRepository(appId: app.documentID)!.add(drawerModel);
  }
  return drawerModel;
}