我的目标是在 Intellij 中将“chrome on android”作为可选的运行/调试配置。
我正在寻找一种在我的 android 手机浏览器上运行我的 flutter web 应用程序的方法。我相信这可以通过结合使用 adb 和 chrome devtools 远程连接的 Intellij 中的自定义运行配置来实现。
说明:这应该是免提的,所有答案都有一个共同点,即我必须手动打开网址,但我正在寻找一种在手机上“启动”网址的方法,就像我们可以在 chrome 中启动网络应用程序一样用于桌面。
我知道有可能让 webapp 在连接的设备上运行 - 我正在寻找的是一个运行配置来自动化启动 web 服务器的步骤,复制 url 将其推送到设备,然后在那里打开 url
我希望重写官方示例,以编写带有底部导航的嵌套导航器。具体来说,我想使用提供程序编写另一个实现来提升状态,而不是将回调传递到页面,就像这里发生的 ?handleBookTapped?。
问:如何使用 Provider 将 BookAppState 传递给页面,同时在不丢失选项卡状态的情况下正确更新外部和内部导航器。
class InnerRouterDelegate extends RouterDelegate<BookRoutePath>
with ChangeNotifier, PopNavigatorRouterDelegateMixin<BookRoutePath> {
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
BooksAppState get appState => _appState;
BooksAppState _appState;
set appState(BooksAppState value) {
if (value == _appState) {
return;
}
_appState = value;
notifyListeners();
}
InnerRouterDelegate(this._appState);
@override
Widget build(BuildContext context) {
return Navigator(
key: navigatorKey,
pages: [
if (appState.selectedIndex == 0) ...[
FadeAnimationPage(
child: BooksListScreen(
books: appState.books,
onTapped: _handleBookTapped,
),
key: ValueKey('BooksListPage'),
),
if (appState.selectedBook != null)
MaterialPage(
key: ValueKey(appState.selectedBook), …Run Code Online (Sandbox Code Playgroud) 根据文档,localhost应该与所有端口一起列入白名单:https://support.google.com/firebase/answer/6400741 ?authuser=0 - 我在控制台和firebase中检查了这一点,并且localhost实际上已列入白名单。
但是当我尝试在 Flutter web 中执行以下操作时,出现未列入白名单的错误:
final GoogleSignIn _googleSignIn;
final googleUser = await _googleSignIn.signIn(); // This is where the error happens
Run Code Online (Sandbox Code Playgroud)
Error: PlatformException(idpiframe_initialization_failed, Not a valid origin for the client: http://localhost:59386 has not been whitelisted for client ID XXXXXX.apps.googleusercontent.com. Please go to https://console.developers.google.com/ and whitelist this origin for your project's client ID., https://developers.google.com/identity/sign-in/web/reference#error_codes, null)
at Object.createErrorWithStack (http://localhost:59386/dart_sdk.js:4353:12)
at Object._rethrow (http://localhost:59386/dart_sdk.js:37968:16)
at async._AsyncCallbackEntry.new.callback (http://localhost:59386/dart_sdk.js:37962:13)
at Object._microtaskLoop (http://localhost:59386/dart_sdk.js:37794:13)
at _startMicrotaskLoop (http://localhost:59386/dart_sdk.js:37800:13)
at http://localhost:59386/dart_sdk.js:33309:9
Run Code Online (Sandbox Code Playgroud)
我使用这些 dart 依赖项:
cloud_firestore: ^0.14.2
firebase_auth: …Run Code Online (Sandbox Code Playgroud)