getScreenInfo method
Returns basic screen / wallpaper information when reliably available.
Implementation
@override
Future<WallpaperScreenInfo> getScreenInfo() async {
try {
final raw = await methodChannel.invokeMapMethod<String, dynamic>(
'getScreenInfo',
);
if (raw == null) return const WallpaperScreenInfo();
return WallpaperScreenInfo(
width: (raw['width'] as num?)?.toDouble(),
height: (raw['height'] as num?)?.toDouble(),
pixelDensity: (raw['pixelDensity'] as num?)?.toDouble(),
orientation: raw['orientation'] as String?,
);
} on PlatformException catch (e) {
debugPrint('getScreenInfo error: ${e.message}');
return const WallpaperScreenInfo();
}
}