|
@@ -23,6 +23,7 @@ class FlutterWebviewPlugin {
|
|
|
|
|
|
|
|
final _channel = const MethodChannel(_kChannel);
|
|
final _channel = const MethodChannel(_kChannel);
|
|
|
|
|
|
|
|
|
|
+ final _onBack = StreamController<Null>.broadcast();
|
|
|
final _onDestroy = StreamController<Null>.broadcast();
|
|
final _onDestroy = StreamController<Null>.broadcast();
|
|
|
final _onUrlChanged = StreamController<String>.broadcast();
|
|
final _onUrlChanged = StreamController<String>.broadcast();
|
|
|
final _onStateChanged = StreamController<WebViewStateChanged>.broadcast();
|
|
final _onStateChanged = StreamController<WebViewStateChanged>.broadcast();
|
|
@@ -33,6 +34,9 @@ class FlutterWebviewPlugin {
|
|
|
|
|
|
|
|
Future<Null> _handleMessages(MethodCall call) async {
|
|
Future<Null> _handleMessages(MethodCall call) async {
|
|
|
switch (call.method) {
|
|
switch (call.method) {
|
|
|
|
|
+ case 'onBack':
|
|
|
|
|
+ _onBack.add(null);
|
|
|
|
|
+ break;
|
|
|
case 'onDestroy':
|
|
case 'onDestroy':
|
|
|
_onDestroy.add(null);
|
|
_onDestroy.add(null);
|
|
|
break;
|
|
break;
|
|
@@ -64,6 +68,9 @@ class FlutterWebviewPlugin {
|
|
|
/// Listening the OnDestroy LifeCycle Event for Android
|
|
/// Listening the OnDestroy LifeCycle Event for Android
|
|
|
Stream<Null> get onDestroy => _onDestroy.stream;
|
|
Stream<Null> get onDestroy => _onDestroy.stream;
|
|
|
|
|
|
|
|
|
|
+ /// Listening the back key press Event for Android
|
|
|
|
|
+ Stream<Null> get onBack => _onBack.stream;
|
|
|
|
|
+
|
|
|
/// Listening url changed
|
|
/// Listening url changed
|
|
|
Stream<String> get onUrlChanged => _onUrlChanged.stream;
|
|
Stream<String> get onUrlChanged => _onUrlChanged.stream;
|
|
|
|
|
|