fromMap static method
Creates a GoogleCastImage from a map representation. Returns null if the URL is missing or invalid.
Implementation
static GoogleCastImage? fromMap(Map<String, dynamic> map) {
final urlString = map['url'];
if (urlString == null || urlString is! String || urlString.isEmpty) {
return null;
}
final uri = Uri.tryParse(urlString);
if (uri == null) return null;
return GoogleCastImage(
url: uri,
height: map['height']?.toInt(),
width: map['width']?.toInt(),
);
}