Created
February 2, 2022 15:35
-
-
Save Sumit-Ghosh/17b1c6913588904b12c6eef7c7238316 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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