create a service extension to terminate an app (#3634)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert' show JSON;
|
||||
import 'dart:developer' as developer;
|
||||
import 'dart:io' show exit;
|
||||
|
||||
import 'package:meta/meta.dart';
|
||||
|
||||
@@ -100,6 +101,10 @@ abstract class BindingBase {
|
||||
name: 'reassemble',
|
||||
callback: reassembleApplication
|
||||
);
|
||||
registerSignalServiceExtension(
|
||||
name: 'exit',
|
||||
callback: _exitApplication
|
||||
);
|
||||
assert(() { _debugServiceExtensionsRegistered = true; return true; });
|
||||
}
|
||||
|
||||
@@ -247,3 +252,8 @@ abstract class BindingBase {
|
||||
@override
|
||||
String toString() => '<$runtimeType>';
|
||||
}
|
||||
|
||||
/// Terminate the Flutter application.
|
||||
void _exitApplication() {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user