34 lines
915 B
Dart
34 lines
915 B
Dart
class DiscoveryAssetModel {
|
|
final String isin;
|
|
final String symbol;
|
|
final String name;
|
|
final String type;
|
|
final String category;
|
|
final String? image;
|
|
final List<String> tags;
|
|
|
|
const DiscoveryAssetModel({
|
|
required this.isin,
|
|
required this.symbol,
|
|
required this.name,
|
|
required this.type,
|
|
required this.category,
|
|
this.image,
|
|
this.tags = const [],
|
|
});
|
|
|
|
factory DiscoveryAssetModel.fromJson(Map<String, dynamic> json) {
|
|
return DiscoveryAssetModel(
|
|
isin: json['isin'] ?? '',
|
|
symbol: (json['symbol'] != null && json['symbol'].toString().isNotEmpty)
|
|
? json['symbol'].toString()
|
|
: (json['isin'] ?? ''),
|
|
name: json['name'] ?? '',
|
|
type: json['type'] ?? 'stock',
|
|
category: json['category'] ?? '',
|
|
image: json['image'],
|
|
tags: (json['tags'] as List<dynamic>?)?.map((e) => e.toString()).toList() ?? [],
|
|
);
|
|
}
|
|
}
|