import 'static_talkgroup.dart'; import 'cluster.dart'; class DeviceProfile { final List blockedGroups; final List staticSubscriptions; final List dynamicSubscriptions; final List timedSubscriptions; final List clusters; DeviceProfile({ this.blockedGroups = const [], this.staticSubscriptions = const [], this.dynamicSubscriptions = const [], this.timedSubscriptions = const [], this.clusters = const [], }); factory DeviceProfile.fromJson(Map json) { return DeviceProfile( blockedGroups: (json['blockedGroups'] as List?) ?.map((e) => StaticTalkgroup.fromJson(e as Map)) .toList() ?? [], staticSubscriptions: (json['staticSubscriptions'] as List?) ?.map((e) => StaticTalkgroup.fromJson(e as Map)) .toList() ?? [], dynamicSubscriptions: (json['dynamicSubscriptions'] as List?) ?.map((e) => StaticTalkgroup.fromJson(e as Map)) .toList() ?? [], timedSubscriptions: (json['timedSubscriptions'] as List?) ?.map((e) => StaticTalkgroup.fromJson(e as Map)) .toList() ?? [], clusters: (json['clusters'] as List?) ?.map((e) => Cluster.fromJson(e as Map)) .toList() ?? [], ); } Map toJson() { return { 'blockedGroups': blockedGroups.map((e) => e.toJson()).toList(), 'staticSubscriptions': staticSubscriptions.map((e) => e.toJson()).toList(), 'dynamicSubscriptions': dynamicSubscriptions.map((e) => e.toJson()).toList(), 'timedSubscriptions': timedSubscriptions.map((e) => e.toJson()).toList(), 'clusters': clusters.map((e) => e.toJson()).toList(), }; } }