packages icon indicating copy to clipboard operation
packages copied to clipboard

[google_sign_in] Don't crash a misconfigured iOS app

Open stuartmorgan-g opened this issue 6 months ago • 1 comments

In https://github.com/flutter/plugins/pull/1180 the plugin was deliberately made to crash when misconfigured. The reasoning was that the app shouldn't be released this way, which is true, but crashing the entire app means that a developer has to use Xcode to debug the app to understand what's happening, which is a very poor user experience.

The PR indicated that the error would be printed from the Dart side after that PR, but that's not actually what happens; method channel returns are asynchronous, whereas crashing the app on the native side with an unhandled exception happens immediately, so even though the native side does call the completion, the async process of that completion being received on the Dart side as a PlatformException was never happening, and the crash was silent outside the context of a native debugger.

This removes the throw, so that it can be received as a Dart exception, which is much easier for most developers to debug.

Pre-Review Checklist

[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.

stuartmorgan-g avatar Jun 24 '25 15:06 stuartmorgan-g

There's no issue linked because this is something I just happened to hit while testing https://github.com/flutter/packages/pull/9484 locally, and had messed up the configuration in my test app.

stuartmorgan-g avatar Jun 24 '25 15:06 stuartmorgan-g