createPageEntity static method

Future<PageEntity> createPageEntity(
  1. dynamic page,
  2. String appId,
  3. String homeMenuId,
  4. String leftDrawerDocumentId,
  5. String rightDrawerDocumentId,
  6. String appBarId, {
  7. Feedback? feedback,
})

Implementation

static Future<PageEntity> createPageEntity(
  dynamic page,
  String appId,
  String homeMenuId,
  String leftDrawerDocumentId,
  String rightDrawerDocumentId,
  String appBarId, {
  Feedback? feedback,
}) async {
  var documentID = page['documentID'];
  page['appId'] = appId;
  page['homeMenuId'] = homeMenuId;
  page['drawerId'] = leftDrawerDocumentId;
  page['endDrawerId'] = rightDrawerDocumentId;
  page['appBarId'] = appBarId;
  var pageEntity = PageEntity.fromMap(page);
  if (pageEntity != null) {
    var newPageEntity =
        await pageRepository(appId: appId)!.addEntity(documentID, pageEntity);
    if (feedback != null) {
      feedback(JsonConsts.pages, documentID);
    }
    return newPageEntity;
  } else {
    throw Exception('Can not create pageEntity');
  }
}