Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

[fix] a nicer error handling instead of app crash#45

Open
PerrchicK wants to merge 1 commit into
rmbrone:masterfrom
PerrchicK:fix/issues/30/handling-unexpected-nil-while-force-unwrapping-string-url-path
Open

[fix] a nicer error handling instead of app crash#45
PerrchicK wants to merge 1 commit into
rmbrone:masterfrom
PerrchicK:fix/issues/30/handling-unexpected-nil-while-force-unwrapping-string-url-path

Conversation

@PerrchicK

@PerrchicK PerrchicK commented Aug 30, 2020

Copy link
Copy Markdown

Main Change

  • Now the app won't crash in case the string path represents an invalid URL (probably due to spaces in path).
  • The plugin will return a Flutter error instead.

Tip 💡

Try not to use force unwrap ! unless you want the app to crash. For example, in let dic = call.arguments as! [String : Any] it's still forgiven because this dictionary must exist, unless there's an integration error. Although I personally prefer to use safe unwrap (if let / guard let) in these cases as well.

Now the app won't crash in case the string path represents an invalid URL (probably due to spaces in path), instead it will return a Flutter error from the plugin.
@PerrchicK

Copy link
Copy Markdown
Author

This PR fixes this issue:
#30

ibedek pushed a commit to ibedek/flutter_audio_recorder that referenced this pull request Mar 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant