FlagReason.fromMap constructor

FlagReason.fromMap(
  1. dynamic map
)

Creates a new FlagReason instance from a map.

Implementation

factory FlagReason.fromMap(dynamic map) {
  if (map == null) {
    throw ArgumentError('The type of flagReason map is null');
  }
  return FlagReason(
    id: map['id'],
    name: map['name'],
    description: map['description'],
    createdAt: map['createdAt'] == 0 || map['createdAt'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(map['createdAt'] * 1000),
    updatedAt: map['updatedAt'] == 0 || map['updatedAt'] == null
        ? null
        : DateTime.fromMillisecondsSinceEpoch(map['updatedAt'] * 1000),
  );
}