Skip to content

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

@r-durao-pvotal

Description

@r-durao-pvotal

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions