Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser wont open second time #239

Closed
mrifni opened this issue Dec 31, 2019 · 3 comments
Closed

Browser wont open second time #239

mrifni opened this issue Dec 31, 2019 · 3 comments
Labels

Comments

@mrifni
Copy link

mrifni commented Dec 31, 2019

Environment

Flutter 1.13.5 • channel dev • https://github.com/flutter/flutter.git
Framework • revision 41a911099b (12 days ago) • 2019-12-19 13:48:02 -0800
Engine • revision 0f90e6546b
Tools • Dart 2.8.0 (build 2.8.0-dev.0.0 aa6709974d)

Running flutter doctor...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.13.5, on Mac OS X 10.14.4 18E226, locale en-GB)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Android Studio (version 3.5)

Description

After opening a url and closing it and reopening the same url throws below error

E/flutter (17160): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Exception: [Error: Cannot open https://5pillarsuk.com/2019/12/29/the-top-international-muslim-stories-2019/! The browser is already opened.]
E/flutter (17160): #0      ChromeSafariBrowser.throwIsAlreadyOpened (package:flutter_inappwebview/src/chrome_safari_browser.dart:125:7)
E/flutter (17160): #1      ChromeSafariBrowser.open (package:flutter_inappwebview/src/chrome_safari_browser.dart:62:10)

My Code

import 'package:flutter/cupertino.dart';
import 'package:flutter_app/common/inapp_browser.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';

class MyBrowser extends ChromeSafariBrowser {
  MyBrowser() : super(bFallback: MyInAppBrowser());

  @override
  void onOpened() {
    debugPrint("ChromeSafari browser opened");
  }

  @override
  void onLoaded() {
    debugPrint("ChromeSafari browser loaded");
  }

  @override
  void onClosed() {
    debugPrint("ChromeSafari browser closed");
  }

  void openLink(url) async {
    await open(
        url: url,
        options: ChromeSafariBrowserClassOptions(androidChromeCustomTabsOptions: AndroidChromeCustomTabsOptions(), iosSafariOptions: IosSafariOptions(barCollapsingEnabled: true)));
  }
}

Then i do in my widget classes

@override
  Widget build(BuildContext context) {
    return GestureDetector(
        onTap: () {
       final ChromeSafariBrowser _browser = MyBrowser();
          _browser.openLink(blogFeedItem.attributes.link);
        },
  );
}

also none of the overridden methods logs wouldnt print either

  void onOpened() {
    debugPrint("ChromeSafari browser opened");
  }

  @override
  void onLoaded() {
    debugPrint("ChromeSafari browser loaded");
  }

  @override
  void onClosed() {
    debugPrint("ChromeSafari browser closed");
  }```
@odajapan
Copy link

I am also facing the same issue using version 3.0.0. It happens with only Android.

E/flutter (13829): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Exception: [Error: Cannot open https://www.google.com The browser is already opened.] E/flutter (13829): #0 ChromeSafariBrowser.throwIsAlreadyOpened (package:flutter_inappwebview/src/chrome_safari_browser.dart:126:7) E/flutter (13829): #1 ChromeSafariBrowser.open (package:flutter_inappwebview/src/chrome_safari_browser.dart:65:10)

This was referenced Jul 6, 2020
Copy link

github-actions bot commented Oct 7, 2024

This issue is stale and has been automatically closed because it has been open for more than 365 days with no activity. Please reopen a new issue if you still have it.

@github-actions github-actions bot added the stale label Oct 7, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 7, 2024
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants