-
Notifications
You must be signed in to change notification settings - Fork 389
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
"Null check operator used on null value" error on read #336
Comments
Can you please provide output of |
`PS ...> flutter doctor -v [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [√] Chrome - develop for the web [√] Android Studio (version 2020.3) [√] Connected device (3 available) • No issues found!` The flutter doctor output doesn't seem to be particularly verbose, even with the -v flag? The device/OS is the one listed above, the Android 11 x86 emulator. I'm going to try to make a minimum reproducible project for the bug, I'll update if that works. |
Secure storage is returning null while reading data. I'm testing the behavior on the iOS simulator, but it's not working. Here is the response for flutter doctor -v Hemas-MacBook-Pro:ios hemandroid$ flutter doctor -v [✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) [✓] Xcode - develop for iOS and macOS [✓] Chrome - develop for the web [✓] Android Studio (version 4.2) [✓] IntelliJ IDEA Community Edition (version 2019.3) [✓] VS Code (version 1.61.2) [✓] Connected device (3 available) • No issues found! Log Response: Null check operator used on a null value |
So it seems this is happening on Android and iOS. @A-a-l-l-e-e-x-x Do you have an update on the sample project? I can't seem to reproduce this myself. |
Hello, I have exactly the same issue than @A-a-l-l-e-e-x-x on 5.0.2. I'm very interested by any suggestions. I'm quite stuck for now.
and:
Thanks |
Can you please try the following:
Source: flutter/flutter#80956 (comment) |
I believe it was related to the 2.5.3 upgrade. All of my tests relying on MethodChannel mocking are failing and I've started the migration process. https://docs.flutter.dev/release/breaking-changes/mock-platform-channels However, for Secure Storage I'm getting
I've also had to use Other tests that are using different plugins are not having this issue when migrating to this new code. EDIT:I found my issue. I forgot to stub out the
|
@juliansteenbakker your suggestion looks good. I have another issue from now. I didn't investigate a lot but I copy it here:
I guess this is due to the fact that we can't test a function having flutter_secure_storage dependencies but I need to mock the flutter_secure_storage calls instead. Right? |
So this is a quick example of how I got it worked for me in my Tests.
|
I would like to thank you. It works. I really appreciate your support. Reading your example, I noticed that I used For info, using
However, adding Cheers. |
I've added a note in the readme.md. |
Using v5.0.2
When calling any kind of read function, whether read or readAll, dart throws the following error:
Null check operator used on a null value - stack:
#0 MethodChannel.binaryMessenger package:flutter/…/services/platform_channel.dart:121
#1 MethodChannel._invokeMethod package:flutter/…/services/platform_channel.dart:146
#2 MethodChannel.invokeMethod package:flutter/…/services/platform_channel.dart:329
#3 MethodChannelFlutterSecureStorage.readAll package:flutter_secure_storage_platform_interface/src/method_channel_flutter_secure_storage.dart:61
#4 FlutterSecureStorage.readAll package:flutter_secure_storage/flutter_secure_storage.dart:164
From the looks of the stacktrace, the issue seems to be deeper-seated within flutter, although I'm obviously quite unsure whether it is due to a true Flutter problem or a bug in the FlutterSecureStorage library.
I'm unfortunately not well-versed enough with the deeper machinations of how Flutter work, so I'm unable to provide a fix pull request.
The text was updated successfully, but these errors were encountered: