asMapOfObject<T> function

Map<String, T> asMapOfObject<T>(
  1. NUIEntMapper<T> entity,
  2. dynamic value
)

Implementation

Map<String, T> asMapOfObject<T>(NUIEntMapper<T> entity, dynamic value){
  final map = asMap(value);
  final mapObject = Map<String, T>();
  map.forEach((key, value) {
    try{
      T objectData = entity.toEntity(value);
      mapObject[key] = objectData;
    }catch(e){
      logNUI("NUIEnt", "Failed to map object of ${entity.entityName()} from map");
    }
  });
  return mapObject;
}