jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.29k stars 1.61k forks source link

Unsupported operation: Platform._operatingSystem #1869

Open songsongtao opened 3 years ago

songsongtao commented 3 years ago
  Directionality Directionality:file:///D:/soft/Flutter/flutter_windows_2.0.4-stable/flutter/.pub-cache/hosted/pub.flutter-io.cn/get-4.3.8/lib/get_navigation/src/root/get_material_app.dart:217:12
When the exception was thrown, this was the stack: 
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 251:49     throw_
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart 244:5                  _operatingSystem
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/io/platform_impl.dart 56:40                                         get operatingSystem
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/io/platform.dart 64:45                                              get _operatingSystem
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 835:8  get
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/io/platform.dart 106:51                                             get isAndroid
C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 835:8  get

web Flutter2.5

atiqsamtia commented 3 years ago

Having this same issue.

khmergeo commented 2 years ago

I got the same issue with Web Flutter 2.5.3

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 2.5.3, on macOS 12.1 21C52 darwin-x64, locale en-KH) [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [✓] Xcode - develop for iOS and macOS [✓] Chrome - develop for the web [✓] Android Studio (version 2020.3) [✓] VS Code (version 1.63.2) [✓] Connected device (1 available)

• No issues found!


My issue error:

[GETX] Instance "GetMaterialController" has been created [GETX] Instance "GetMaterialController" has been initialized

════════ Exception caught by widgets library ═══════════════════════════════════ The following UnsupportedError was thrown building Builder: Unsupported operation: Platform._operatingSystem

The relevant error-causing widget was GetMaterialApp lib/main.dart:35 When the exception was thrown, this was the stack dart-sdk/lib/_internal/js_dev_runtime/private/ddcruntime/errors.dart 251:49 throw dart-sdk/lib/_internal/js_dev_runtime/patch/io_patch.dart 244:5 _operatingSystem dart-sdk/lib/io/platform_impl.dart 56:40 get operatingSystem dart-sdk/lib/io/platform.dart 64:45 get _operatingSystem ...

khmergeo commented 2 years ago

I found my problem is an error with another package of google_mobile_ads not supported in a web browser, not GetX.

I solved with code: if (!kIsWeb)