makeText method
makeText is the function responsible to show the toast natively.
message
is the required parameter inorder to show the text message.
duration
is the optional parameter to set how log a Toast
is show.
by default it is set to shortLength
Implementation
Future<void> makeText(
{required String message, int duration = shortLength}) async {
if (Platform.isAndroid) {
try {
await _channel.invokeMethod("showToast", {
"message": message,
"duration": duration,
});
} catch (error) {
rethrow;
}
} else {
throw "NativeToast is plugin only made for Android.";
}
}