getDeviceScreenSize method
Retrieves the screen size of the device.
Returns the screen size as a string in the format 'width x height'. If an error occurs, it returns 'Unknown'.
Implementation
Future<String> getDeviceScreenSize() async {
try {
final view = WidgetsBinding.instance.platformDispatcher.views.first;
final width = view.physicalSize.width;
final height = view.physicalSize.height;
return '${width.toInt()} x ${height.toInt()}';
} catch (e) {
debugPrint('Error getting screen size: $e');
return 'Unknown';
}
}