在模拟器上从 flutter 中的 url 启动器启动时,有什么东西导致了错误?
While launching from an url launcher in flutter on simulator ,something caused an error?
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method canLaunch on channel plugins.flutter.io/url_launcher)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
<asynchronous suspension>
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#2 MethodChannelUrlLauncher.canLaunch (package:url_launcher_platform_interface/method_channel_url_launcher.dart:18:21)
#3 canLaunch (package:url_launcher/url_launcher.dart:111:45)
#4 _ProfileState.buildProfileHeader.<anonymous closure>.<anonymous closure> (package:focal/pages/profile.dart:475:31)
#5 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:779:19)
#6 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:862:36)
#7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
#8 TapGestureRecognizer.ha<…>
我遇到了这个错误,而 运行 如何解决这个问题。这是我正在尝试的代码,但它没有打开 link 并且似乎什么也没发生。我已经安装了 url 启动器插件 ^5.4.10
String test = 'www.fiverr.com/share/yv32Eb';
Padding(
padding: EdgeInsets.only(top: 2, left: 5),
child: InkWell(
splashColor: Colors.green.withOpacity(0.3),
onTap: () async {
if (await canLaunch(test)) {
await launch(test);
}
print('nothing');
},
child: Center(
child: Padding(
padding: EdgeInsets.only(top: 2),
child: SizedBox(
height: 20,
width: MediaQuery.of(context).size.width * 0.5,
child: Text(
'www.fiverr.com/share/hifhsjbfvbhvs/ihfahiuhf/ahaknn?/;kjiuasnjkc',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Colors.green,
fontWeight: FontWeight.bold,
letterSpacing: 1.5,
fontSize: 13,
),
),
),
),
),
),
),
],
),
);
您可能需要重新启动您的应用程序。
在重新启动我的应用程序之前导入 package:url_launcher/url_launcher.dart
后,我遇到了同样的问题。应用重启似乎可以解决我的错误。
[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method canLaunch on channel plugins.flutter.io/url_launcher)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
<asynchronous suspension>
#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#2 MethodChannelUrlLauncher.canLaunch (package:url_launcher_platform_interface/method_channel_url_launcher.dart:18:21)
#3 canLaunch (package:url_launcher/url_launcher.dart:111:45)
#4 _ProfileState.buildProfileHeader.<anonymous closure>.<anonymous closure> (package:focal/pages/profile.dart:475:31)
#5 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:779:19)
#6 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:862:36)
#7 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
#8 TapGestureRecognizer.ha<…>
我遇到了这个错误,而 运行 如何解决这个问题。这是我正在尝试的代码,但它没有打开 link 并且似乎什么也没发生。我已经安装了 url 启动器插件 ^5.4.10
String test = 'www.fiverr.com/share/yv32Eb';
Padding(
padding: EdgeInsets.only(top: 2, left: 5),
child: InkWell(
splashColor: Colors.green.withOpacity(0.3),
onTap: () async {
if (await canLaunch(test)) {
await launch(test);
}
print('nothing');
},
child: Center(
child: Padding(
padding: EdgeInsets.only(top: 2),
child: SizedBox(
height: 20,
width: MediaQuery.of(context).size.width * 0.5,
child: Text(
'www.fiverr.com/share/hifhsjbfvbhvs/ihfahiuhf/ahaknn?/;kjiuasnjkc',
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: TextStyle(
color: Colors.green,
fontWeight: FontWeight.bold,
letterSpacing: 1.5,
fontSize: 13,
),
),
),
),
),
),
),
],
),
);
您可能需要重新启动您的应用程序。
在重新启动我的应用程序之前导入 package:url_launcher/url_launcher.dart
后,我遇到了同样的问题。应用重启似乎可以解决我的错误。