openAppsSettings static method
openAppsSettings method is used to open settings.
As a input user will specify which settings
should be open.
All SettingsCode are defined in SettingsCode enum.
onCompletion
method parameter is optional.
If user wants to execute something after returning back from settings then can pass
through onCompletion
method
Implementation
static Future<void> openAppsSettings(
{required SettingsCode settingsCode, Function? onCompletion}) async {
try {
String code = settingsCode.toString().split('.').last;
int res = await _channel
.invokeMethod("openSettings", {"setting_code": code.toLowerCase()});
if (res >= 0) {
if (onCompletion != null) onCompletion();
}
} on PlatformException catch (e) {
throw PlatformException(
code: e.code,
message: e.message,
details: e.details,
stacktrace: e.stacktrace);
}
}