setFrameworkHandlesBack static method
- bool frameworkHandlesBack
Informs the platform of whether or not the Flutter framework will handle back events.
Currently, this is used only on Android to inform its use of the predictive back gesture when exiting the app. When true, predictive back is disabled.
See also:
- The migration guide for predictive back in native Android apps.
Implementation
static Future<void> setFrameworkHandlesBack(bool frameworkHandlesBack) async {
// Currently, this method call is only relevant on Android.
if (kIsWeb) {
return;
}
switch (defaultTargetPlatform) {
case TargetPlatform.iOS:
case TargetPlatform.macOS:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
return;
case TargetPlatform.android:
return SystemChannels.platform.invokeMethod<void>(
'SystemNavigator.setFrameworkHandlesBack',
frameworkHandlesBack,
);
}
}