import 'channel.dart'; class Store { final String id; String name; List channels; Store({ required this.id, required this.name, required this.channels, }); Map toJson() => { 'id': id, 'name': name, 'channels': channels.map((c) => c.toJson()).toList(), }; factory Store.fromJson(Map json) { return Store( id: json['id'], name: json['name'], channels: (json['channels'] as List) .map((c) => Channel.fromJson(c)) .toList(), ); } }