flutter_web_auth icon indicating copy to clipboard operation
flutter_web_auth copied to clipboard

[macOS] [version 0.4.3]: unexpectedly found nil while unwrapping an Optional value

Open r-durao-pvotal opened this issue 1 year ago • 0 comments

Getting this error when trying to perform a redirect to my auth:

flutter_web_auth/FlutterWebAuthPlugin.swift:38: Fatal error: Unexpectedly found nil while unwrapping an Optional value

Tried looking at the code in question, but unfamiliar with Swift, seems to be that keyWindow is null? Is there any setup step for macOS that is needed before using this library?

   guard let provider = NSApplication.shared.keyWindow!.contentViewController as? FlutterViewController else {
                result(FlutterError(code: "FAILED", message: "Failed to aquire root FlutterViewController" , details: nil))
                return
            }

flutter doctor output:

~/$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.1, on macOS 13.3.1 22E772610a darwin-arm64, locale en-PT)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.1.3)
[✓] VS Code (version 1.78.1)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!

r-durao-pvotal avatar May 25 '23 08:05 r-durao-pvotal