Commit 53c07045 authored by Devon Carew's avatar Devon Carew

create a service extension to terminate an app (#3634)

parent 7c017898
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert' show JSON; import 'dart:convert' show JSON;
import 'dart:developer' as developer; import 'dart:developer' as developer;
import 'dart:io' show exit;
import 'package:meta/meta.dart'; import 'package:meta/meta.dart';
...@@ -100,6 +101,10 @@ abstract class BindingBase { ...@@ -100,6 +101,10 @@ abstract class BindingBase {
name: 'reassemble', name: 'reassemble',
callback: reassembleApplication callback: reassembleApplication
); );
registerSignalServiceExtension(
name: 'exit',
callback: _exitApplication
);
assert(() { _debugServiceExtensionsRegistered = true; return true; }); assert(() { _debugServiceExtensionsRegistered = true; return true; });
} }
...@@ -247,3 +252,8 @@ abstract class BindingBase { ...@@ -247,3 +252,8 @@ abstract class BindingBase {
@override @override
String toString() => '<$runtimeType>'; String toString() => '<$runtimeType>';
} }
/// Terminate the Flutter application.
void _exitApplication() {
exit(0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment