import 'package:sport/services/Converter.dart'; /// id : 4 /// type : "image" /// url : "http://4.jpg" /// position : 4 /// cover : "" /// game_id : 3 class Carousel { late int id; late String type; late String url; late int position; late String? cover; late int gameId; late String? outerUrl; late String? outerDesc; Map toMap() { return { 'id': this.id, 'type': this.type, 'url': this.url, 'position': this.position, 'cover': this.cover, 'game_id': this.gameId, 'outer_url': this.outerUrl, 'outer_desc': this.outerDesc, }; } factory Carousel.fromMap(Map map) { return Carousel( id: map['id'] as int, type: map['type'] as String, url: map['url'] as String, position: map['position'] as int, cover: map['cover'] as String?, gameId: Converter.toInt(map['game_id']), outerUrl: map['outer_url'] as String?, outerDesc: map['outer_desc'] as String?, ); } Carousel({ required this.id, required this.type, required this.url, required this.position, required this.cover, required this.gameId, required this.outerUrl, required this.outerDesc, }); }