Skip to content

Instantly share code, notes, and snippets.

@Sumit-Ghosh
Created February 2, 2022 15:39
Show Gist options
  • Save Sumit-Ghosh/6ca06a2adbed1dd2bfff91efe0ee1995 to your computer and use it in GitHub Desktop.
Save Sumit-Ghosh/6ca06a2adbed1dd2bfff91efe0ee1995 to your computer and use it in GitHub Desktop.
Future<void> _getDeviceModel() async {
String _model;
try {
// 1
final String result = await platformChannel.invokeMethod('getDeviceModel');
// 2
_model = result;
} catch (e) {
// 3
_model = "Can't fetch the method: '$e'.";
}
// 4
setState(() {
_deviceModel = _model;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment