ThaVideoTrack.fromMap constructor

ThaVideoTrack.fromMap(
  1. Map map
)

Implementation

factory ThaVideoTrack.fromMap(Map<dynamic, dynamic> map) {
  // ignore: no_leading_underscores_for_local_identifiers
  int? _int(dynamic v) {
    if (v == null) return null;
    if (v is int) return v;
    if (v is double) return v.round();
    return int.tryParse(v.toString());
  }

  return ThaVideoTrack(
    id: map['id']?.toString() ?? '',
    label: map['label']?.toString(),
    bitrate: _int(map['bitrate']),
    width: _int(map['width']),
    height: _int(map['height']),
    selected: map['selected'] == true,
  );
}