appsup-dart/openid_client

MissingPluginException(No implementation found for method canLaunch on channel plugins.flutter.io/url_launcher_macos)

Closed this issue · 1 comments

From a Mac M1 I want to launch a Flutter Module Test for Android.
(Same hardware, but the console version it works: the Mac will launch the browser to auto if I run as web - Chrome runtime the test) - so the parameters should be ok

The code:

authenticateFlutter(Uri uri, String clientId, List<String> scopes) async {
  // create the client
  var issuer = await Issuer.discover(uri);
  var client = Client(issuer, clientId);

  // create a function to open a browser with an url
  urlLauncher(String url) async {
    Uri uri = Uri.parse(url);
    if (await canLaunchUrl(uri)) {
      await launchUrl(uri);
    } else {
      throw 'Could not launch $uri';
    }
  }

  // create an authenticator
  var authenticator = Authenticator(client, scopes: scopes, port: 4000, urlLancher: urlLauncher);

  // starts the authentication
  var credential = await authenticator.authorize();

  // close the webview when finished
  closeInAppWebView();

The problem is at:

await authenticator.authorize();
await _startServer(port);
urlLancher(flow.authenticationUri.toString());

Screenshot_2022-12-16_at_12_20_11

This seems to be an issue with the https://pub.dev/packages/url_launcher_macos package.