fromMap static method

RgbEntity? fromMap(
  1. Object? o, {
  2. Map<String, String>? newDocumentIds,
})

Implementation

static RgbEntity? fromMap(Object? o, {Map<String, String>? newDocumentIds}) {
  if (o == null) return null;
  var map = o as Map<String, dynamic>;

  return RgbEntity(
    r: int.tryParse(map['r'].toString()),
    g: int.tryParse(map['g'].toString()),
    b: int.tryParse(map['b'].toString()),
    opacity: double.tryParse(map['opacity'].toString()),
  );
}