-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve message for assert that catches CupertinoSwitch(value: null)
#12948
Comments
Where there any analyzer warnings? |
CupertinoSwitch(value: null)
(We should probably consider improving these |
They only had to do with other parts of the app. There were no analyzer
warnings about that block of code.
…On Dec 19, 2017 7:15 PM, "Ian Hickson" ***@***.***> wrote:
Where there any analyzer warnings?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#12948 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARZQa0JhOPqwurt_Udtr0QNvHiCn49Dxks5tCG2ugaJpZM4QYTJn>
.
|
Thanks for the update. We'll improve the error message, though this won't happy in the near future. |
We should document CupertinoSwitch.value that it can't be null and assert != null in the constructor. |
Documented CupertinoSwitch.value that it can't be null and added an assertion value != null in the constructor. Related issue: #12948
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Steps to Reproduce
I was just learning how to use the CupertinoSwitch widget and didn't really know anything. I briefly looked at the docs for it a week before attempting to use it in my app.
I just did
because I didn't really know what I was doing. I had previously put in false on the value parameter because I wanted it to start out being false/off and it worked fine. At that point, I also didn't have a good callback, so my Switch wasn't responding to user input. That's when I started experimenting more and put null in for the value.
After the fact, I see that the doc gives a fairly good example, so I recognize that there was more that I could've done to understand how to use it (And I understand it now), but the flutter compiler told me that the error that it gave me wasn't clear and that I should file an issue for this reason.
I've included the Flutter Run results and Flutter Doctor results and I think that is sufficient to file the issue. Nothing in the Flutter Analysis was relavent to this discussion.
Logs
Flutter Doctor
Paste the output of running
flutter doctor
here.[✓] Flutter (on Mac OS X 10.12.6 16G29, locale en-US, channel alpha)
• Flutter at /Users/jonathansteele/flutter
• Framework revision e8aa40e (3 weeks ago), 2017-10-17 15:42:40 -0700
• Engine revision 7c41428
• Tools Dart version 1.25.0-dev.11.0
[✓] Android toolchain - develop for Android devices (Android SDK 25.0.3)
• Android SDK at /Users/jonathansteele/Library/Android/sdk
• Platform android-25, build-tools 25.0.3
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.1, Build version 9B55
• ios-deploy 1.9.2
• CocoaPods version 1.3.1
[✓] Android Studio (version 2.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Java version OpenJDK Runtime Environment (build 1.8.0_112-release-b06)
[✓] IntelliJ IDEA Ultimate Edition (version 2017.1.2)
• Flutter plugin version 17.0
• Dart plugin version 171.4424
[✓] Connected devices
• XT1094 • TA99120J8Y • android-arm • Android 5.1 (API 22)
The text was updated successfully, but these errors were encountered: