-
Notifications
You must be signed in to change notification settings - Fork 247
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
Flutter app fails to configure AWS Amplify (Null check operator used on a null value) #1255
Comments
Hello @pflugs30 - If you want to write a test that includes configuring amplify (or really interacting with Amplify at all), you should write an integration test. The You can follow the flutter integration testing guide here, but there are really just two small changes you need to make to make this test work.
dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
Let me know if you have any questions. |
Documentation around testing is currently a gap. I created an issue to track this gap. |
You are correct that using the integration test approach resolved the issue. Thank you further for making an issue to update the documentation. |
Describe the bug
I ran into a problem while upgrading a production app from AWS Amplify Flutter 0.1.X to ^0.2.0. The Flutter app fails to configure the Amplify packages without error. I then created a brand new Flutter application, following the steps on the Getting Started documentation and the Authentication page. I experienced the exact same error, despite building a project from scratch, including the AWS resources.
To Reproduce
Steps to reproduce the behavior:
flutter test test\my_test.dart
Actual Behavior
When I run the test file above, I get the following output:
I had a suspicion that the Amplify packages don't play nicely with the test runner, so I ran the built the project and ran the tests on my Samsung Galaxy S21 5G running Android 11. When I ran
flutter run test\my_test.dart
, I observed this output:In other words, I saw the same results running in the test runner as on a real device.
Expected behavior
I expect that the test will pass without issue as the Amplify CLI should have properly created an
amplifyconfiguration.dart
file and the packages load the configuration successfully.Screenshots
Here's a screenshot of debugging the
await Amplify.configure(amplifyconfig);
line in Android Studio:Note that in the screenshot I'm hovering over line 35 of
method_channel_auth_cognito.dart
where the watch window shows the same message ("Null check operator used on a null value") as can be seen from the test output.Platform
Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply):
[X] Android
[X] iOS
Output of
flutter doctor -v
Dependencies (
pubspec.lock
)Smartphone (please complete the following information):
Additional context
pubspec.yaml
amplifyconfiguration.dart (obfuscated)
The text was updated successfully, but these errors were encountered: