jeremiahlukus / flutter_template

template with tests, login flow, riverpod, logging ect.
MIT License
24 stars 5 forks source link

Error: Unsupported operation: Platform._operatingSystem #20

Open gradycsjohnson opened 2 years ago

gradycsjohnson commented 2 years ago

First, I love the template! Very nice work.

Second, I'm sorry if I didn't follow instructions properly. I didn't understand this instruction from the README: Setup your backend to login a user.

I'm trying to run the template using the launch configuration in VSCode (ie. not using Docker). It launches on chrome by default, which is what I want.

I'm running on Ubuntu 20.04 but I don't think that should matter. Anyway, my flutter doctor output is included below.

The splash screen and sign in page load just fine.

image

Unfortunately, when I click the Sign in button I get the following exception:

Launching lib/main_development.dart on Chrome in debug mode...
lib/main_development.dart:1
This app is linked to the debug service: ws://127.0.0.1:39817/daVhbIDNFFs=/ws
Debug service listening on ws://127.0.0.1:39817/daVhbIDNFFs=/ws
πŸ’ͺ Running with sound null safety πŸ’ͺ
Connecting to VM Service at ws://127.0.0.1:39817/daVhbIDNFFs=/ws
Flutter Web Bootstrap: Auto
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ #0   packages/flutter_template/core/infrastructure/provider_logger.dart 48:21  didUpdateProvider
β”‚ #1   packages/riverpod/src/framework/container.dart 48:7                       _runQuaternaryGuarded
β”œβ”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„
β”‚ πŸ’‘ {
β”‚ πŸ’‘   "didUpdateProvider": {
β”‚ πŸ’‘     "type": "StateNotifierProvider<AuthNotifier, AuthState>",
β”‚ πŸ’‘     "new_value": "AuthState.unauthenticated()",
β”‚ πŸ’‘     "old_value": "AuthState.initial()"
β”‚ πŸ’‘   }
β”‚ πŸ’‘ }
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ #0   packages/flutter_template/core/infrastructure/provider_logger.dart 48:21  didUpdateProvider
β”‚ #1   packages/riverpod/src/framework/container.dart 48:7                       _runQuaternaryGuarded
β”œβ”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„
β”‚ πŸ’‘ {
β”‚ πŸ’‘   "didUpdateProvider": {
β”‚ πŸ’‘     "type": "FutureProvider<Unit>",
β”‚ πŸ’‘     "new_value": "AsyncData<Unit>(value: ())",
β”‚ πŸ’‘     "old_value": "AsyncLoading<Unit>()"
β”‚ πŸ’‘   }
β”‚ πŸ’‘ }

Error: Unsupported operation: Platform._operatingSystem
    at Object.throw_ [as throw] (http://localhost:37881/dart_sdk.js:5080:11)
    at _Platform._operatingSystem (http://localhost:37881/dart_sdk.js:57539:17)
    at get operatingSystem [as operatingSystem] (http://localhost:37881/dart_sdk.js:57585:27)
    at get _operatingSystem (http://localhost:37881/dart_sdk.js:57498:27)
    at desc.get [as _operatingSystem] (http://localhost:37881/dart_sdk.js:5565:17)
    at get operatingSystem [as operatingSystem] (http://localhost:37881/dart_sdk.js:57449:26)
at get operatingSystem [as operatingSystem] (http://localhost:37881/packages/platform/src/interface/local_platform.dart.lib.js:25:26)
at get isAndroid [as isAndroid] (http://localhost:37881/packages/platform/src/interface/platform.dart.lib.js:43:19)
at WebAppAuthenticator.authorizationEndpoint (http://localhost:37881/packages/flutter_template/auth/infrastructure/webapp_authenticator.dart.lib.js:86:79)
at webapp_authenticator.WebAppAuthenticator.new.getAuthorizationUrl (http://localhost:37881/packages/flutter_template/auth/infrastructure/webapp_authenticator.dart.lib.js:150:55)
at auth_notifier.AuthNotifier.new.signIn (http://localhost:37881/packages/flutter_template/auth/notifiers/auth_notifier.dart.lib.js:194:78)
    at signIn.next (<anonymous>)   
    at runBody (http://localhost:37881/dart_sdk.js:40660:34)
    at Object._async [as async] (http://localhost:37881/dart_sdk.js:40691:7)
at auth_notifier.AuthNotifier.new.signIn (http://localhost:37881/packages/flutter_template/auth/notifiers/auth_notifier.dart.lib.js:193:20)
at http://localhost:37881/packages/flutter_template/auth/presentation/sign_in_page.dart.lib.js:399:103
at [_handleTap] (http://localhost:37881/packages/flutter/src/material/icon_button.dart.lib.js:42254:31)
at tap.TapGestureRecognizer.new.invokeCallback (http://localhost:37881/packages/flutter/src/gestures/recognizer.dart.lib.js:198:18)
at tap.TapGestureRecognizer.new.handleTapUp (http://localhost:37881/packages/flutter/src/gestures/tap.dart.lib.js:411:42)
at [_checkUp] (http://localhost:37881/packages/flutter/src/gestures/tap.dart.lib.js:217:12)
at tap.TapGestureRecognizer.new.handlePrimaryPointer (http://localhost:37881/packages/flutter/src/gestures/tap.dart.lib.js:166:23)
at tap.TapGestureRecognizer.new.handleEvent (http://localhost:37881/packages/flutter/src/gestures/recognizer.dart.lib.js:444:16)
at [_dispatch] (http://localhost:37881/packages/flutter/src/gestures/pointer_router.dart.lib.js:86:9)
at http://localhost:37881/packages/flutter/src/gestures/pointer_router.dart.lib.js:112:26
    at LinkedMap.new.forEach (http://localhost:37881/dart_sdk.js:27745:11)
at [_dispatchEventToRoutes] (http://localhost:37881/packages/flutter/src/gestures/pointer_router.dart.lib.js:110:29)
at pointer_router.PointerRouter.new.route (http://localhost:37881/packages/flutter/src/gestures/pointer_router.dart.lib.js:105:37)
at binding$5.WidgetsFlutterBinding.new.handleEvent (http://localhost:37881/packages/flutter/src/gestures/binding.dart.lib.js:367:26)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:37881/packages/flutter/src/gestures/binding.dart.lib.js:355:24)
at binding$5.WidgetsFlutterBinding.new.dispatchEvent (http://localhost:37881/packages/flutter/src/rendering/layer.dart.lib.js:5440:13)
at [_handlePointerEventImmediately] (http://localhost:37881/packages/flutter/src/gestures/binding.dart.lib.js:331:14)
at binding$5.WidgetsFlutterBinding.new.handlePointerEvent (http://localhost:37881/packages/flutter/src/gestures/binding.dart.lib.js:305:43)
at [_flushPointerEventQueue] (http://localhost:37881/packages/flutter/src/gestures/binding.dart.lib.js:295:14)
at [_handlePointerDataPacket] (http://localhost:37881/packages/flutter/src/gestures/binding.dart.lib.js:286:54)
    at Object.invoke1 (http://localhost:37881/dart_sdk.js:191747:7)
    at _engine.EnginePlatformDispatcher.__.invokeOnPointerDataPacket (http://localhost:37881/dart_sdk.js:171943:15)
    at [_onPointerData] (http://localhost:37881/dart_sdk.js:172879:49)
    at http://localhost:37881/dart_sdk.js:173317:28
    at http://localhost:37881/dart_sdk.js:173273:16
    at loggedHandler (http://localhost:37881/dart_sdk.js:172978:11)

Here's my flutter doctor output:

> flutter doctor -v
[βœ“] Flutter (Channel stable, 3.0.5, on Ubuntu 20.04.4 LTS
    5.15.0-41-generic, locale en_CA.UTF-8)
    β€’ Flutter version 3.0.5 at /home/gj/snap/flutter/common/flutter
    β€’ Upstream repository https://github.com/flutter/flutter.git
    β€’ Framework revision f1875d570e (3 weeks ago), 2022-07-13 11:24:16
      -0700
    β€’ Engine revision e85ea0e79c
    β€’ Dart version 2.17.6
    β€’ DevTools version 2.12.2

[βœ“] Android toolchain - develop for Android devices (Android SDK version
    30.0.2)
    β€’ Android SDK at /home/gj/Android/Sdk
    β€’ Platform android-30, build-tools 30.0.2
    β€’ ANDROID_HOME = /home/gj/Android/Sdk
    β€’ Java binary at: /opt/android-studio-4.0/android-studio/jre/bin/java
    β€’ Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)
    β€’ All Android licenses accepted.

[βœ“] Chrome - develop for the web
    β€’ CHROME_EXECUTABLE = /usr/bin/google-chrome

[βœ“] Linux toolchain - develop for Linux desktop
    β€’ clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
    β€’ cmake version 3.10.2
    β€’ ninja version 1.8.2
    β€’ pkg-config version 0.29.1

[βœ“] Android Studio (version 4.0)
    β€’ Android Studio at /opt/android-studio-4.0/android-studio
    β€’ Flutter plugin version 51.0.1
    β€’ Dart plugin version 193.7547
    β€’ Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[βœ“] Android Studio
    β€’ Android Studio at /opt/android-studio
    β€’ Flutter plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
    β€’ Dart plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart
    β€’ Java version OpenJDK Runtime Environment (build
      1.8.0_242-release-1644-b3-6222593)

[βœ“] Android Studio
    β€’ Android Studio at /home/gj/android-studio
    β€’ Flutter plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
    β€’ Dart plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart
    β€’ Java version OpenJDK Runtime Environment (build
      11.0.10+0-b96-7249189)

[βœ“] VS Code (version 1.69.2)
    β€’ VS Code at /usr/share/code
    β€’ Flutter extension version 3.44.0

[βœ“] Connected device (2 available)
    β€’ Linux (desktop) β€’ linux  β€’ linux-x64      β€’ Ubuntu 20.04.4 LTS
      5.15.0-41-generic
    β€’ Chrome (web)    β€’ chrome β€’ web-javascript β€’ Google Chrome
      103.0.5060.134

[βœ“] HTTP Host Availability
    β€’ All required HTTP hosts are available

β€’ No issues found!

Thanks for reading! Any help would be greatly appreciated!

jeremiahlukus commented 2 years ago

I believe its due to the web view plug-in not being supported in web. it should work on everything but web right now. I am working on a fix for this as the app im building from the template needs be available on web

jeremiahlukus commented 2 years ago

https://github.com/jeremiahlukus/flutter_template/blob/master/README.md#important-web-isnt-supported-yet-since-the-web-view-plug-in-used-for-auth-doesnt-support-web-i-should-get-to-this-early-august

I added a note in the readme for it

gradycsjohnson commented 2 years ago

Thanks for getting back to me so quickly! I'm excited to try this template out!

jeremiahlukus commented 2 years ago

No problem, I’ll leave this open as a reminder to ping you when I add it in.

In the meantime an app im building from this template is https://github.com/jeremiahlukus/guitar_tabs

This is a more complete example using the pattens established in the template.

jeremiahlukus commented 2 years ago

https://github.com/jeremiahlukus/flutter_template/tree/jlp-web-webview

is where I’m messing with it, you are more than welcome to send a PR if you do not want to wait

jeremiahlukus commented 2 years ago
Screen Shot 2022-08-02 at 8 24 08 PM

https://github.com/jeremiahlukus/flutter_template/pull/23

this PR enables web webviews

gradycsjohnson commented 2 years ago

Amazing! Thanks for jumping on that so quickly!

gradycsjohnson commented 2 years ago

It's still not working for me :(

image

Console output is not giving me much:

Launching lib/main_development.dart on Chrome in debug mode...
lib/main_development.dart:1
This app is linked to the debug service: ws://127.0.0.1:40733/uRyvwXzIhrY=/ws
Debug service listening on ws://127.0.0.1:40733/uRyvwXzIhrY=/ws
πŸ’ͺ Running with sound null safety πŸ’ͺ
Connecting to VM Service at ws://127.0.0.1:40733/uRyvwXzIhrY=/ws
Flutter Web Bootstrap: Auto
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ #0   packages/flutter_template/core/infrastructure/provider_logger.dart 48:21  didUpdateProvider
β”‚ #1   packages/riverpod/src/framework/container.dart 48:7                       _runQuaternaryGuarded
β”œβ”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„
β”‚ πŸ’‘ {
β”‚ πŸ’‘   "didUpdateProvider": {
β”‚ πŸ’‘     "type": "StateNotifierProvider<AuthNotifier, AuthState>",
β”‚ πŸ’‘     "new_value": "AuthState.unauthenticated()",
β”‚ πŸ’‘     "old_value": "AuthState.initial()"
β”‚ πŸ’‘   }
β”‚ πŸ’‘ }
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ #0   packages/flutter_template/core/infrastructure/provider_logger.dart 48:21  didUpdateProvider
β”‚ #1   packages/riverpod/src/framework/container.dart 48:7                       _runQuaternaryGuarded
β”œβ”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„β”„
β”‚ πŸ’‘ {
β”‚ πŸ’‘   "didUpdateProvider": {
β”‚ πŸ’‘     "type": "FutureProvider<Unit>",
β”‚ πŸ’‘     "new_value": "AsyncData<Unit>(value: ())",
β”‚ πŸ’‘     "old_value": "AsyncLoading<Unit>()"
β”‚ πŸ’‘   }
β”‚ πŸ’‘ }
└───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Height of Platform View type: [webview-iframe] may not be set. Defaulting to `height: 100%`.
Set `style.height` to any appropriate value to stop this message.
Width of Platform View type: [webview-iframe] may not be set. Defaulting to `width: 100%`.
Set `style.width` to any appropriate value to stop this message.
crbug/1173575, non-JS module files deprecated.
jeremiahlukus commented 2 years ago

Did you change the auth url as mentioned above? @gradycsjohnson

jeremiahlukus commented 2 years ago

It’s pointing to local host so if you don’t have a separate server running on local host that serves auth pages then it won’t work. You can easily change the url to GitHub auth or google etc if you wanted however

jeremiahlukus commented 2 years ago

Actually the webview works but doesnt at the same time... Navigation delegate isnt supported since the web webview renders an iframe you are pretty limited on what you can do. This is going to take a bit more consideration on how to make this happen. Ill leave this issue open until it gets supported but ill have to tackle it another time.