Skip to content

Instantly share code, notes, and snippets.

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