You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
744 B
32 lines
744 B
// image_metadata_model.dart |
|
import 'package:problem_check_system/data/models/enum_model.dart'; |
|
|
|
class ImageMetadata { |
|
final String localPath; |
|
final String? remoteUrl; |
|
final ImageStatus status; |
|
|
|
ImageMetadata({ |
|
required this.localPath, |
|
this.remoteUrl, |
|
required this.status, |
|
}); |
|
|
|
// For saving to SQL |
|
Map<String, dynamic> toMap() { |
|
return { |
|
'localPath': localPath, |
|
'remoteUrl': remoteUrl, |
|
'status': status.index, |
|
}; |
|
} |
|
|
|
// For reading from SQL |
|
factory ImageMetadata.fromMap(Map<String, dynamic> map) { |
|
return ImageMetadata( |
|
localPath: map['localPath'] as String, |
|
remoteUrl: map['remoteUrl'] as String?, |
|
status: ImageStatus.values[map['status'] as int], |
|
); |
|
} |
|
}
|
|
|