setLanguage method
Selects the installed keyboard matching languageTag. Returns false
when none matches; throws UnsupportedError where impossible.
Implementation
@override
Future<bool> setLanguage(String languageTag) async {
try {
final ok = await methodChannel.invokeMethod<bool>(
'setLanguage',
<String, Object>{'languageTag': languageTag},
);
return ok ?? false;
} on MissingPluginException {
throw UnsupportedError(
'Switching the keyboard language is not supported on this platform.',
);
} on PlatformException catch (e) {
if (e.code == 'unsupported') {
throw UnsupportedError(
e.message ??
'Switching the keyboard language is not supported on this '
'platform.',
);
}
rethrow;
}
}