googlecodelabs / photos-sharing

Code for the "Build a Photo Sharing app with Google Photos and Flutter" codelab
Apache License 2.0
98 stars 71 forks source link

Step #3 Running the App throws Localizations.localeOf(context, nullOk: true) : null #30

Closed MitchDresdner closed 3 years ago

MitchDresdner commented 3 years ago

Step #3 Running the App from Github throws exception

IntelliJ IDEA 2021.1 (Ultimate Edition) Build #IU-211.6693.111, built on April 6, 2021 Runtime version: 11.0.10+9-b1341.35 x86_64 VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o. macOS 11.3 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 16 Non-Bundled Plugins: Dart (211.7233), io.flutter (55.1.5) Kotlin: 211-1.4.32-release-IJ6693.72

flutter --version Flutter 2.0.5 • channel stable • https://github.com/flutter/flutter.git Framework • revision adc687823a (12 days ago) • 2021-04-16 09:40:20 -0700 Engine • revision b09f014e96 Tools • Dart 2.12.3

Launching lib/main.dart on sdk gphone x86 arm in debug mode... Running Gradle task 'assembleDebug'... /usr/local/Caskroom/flutter/2.0.4/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.19.1/lib/src/picture_provider.dart:52:59: Error: No named parameter with the name 'nullOk'. context != null ? Localizations.localeOf(context, nullOk: true) : null, ^^^^^^ /usr/local/Caskroom/flutter/2.0.4/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match. static Locale localeOf(BuildContext context) { ^^^^^^^^

FAILURE: Build failed with an exception.

BUILD FAILED in 11s Exception: Gradle task assembleDebug failed with exit code 1

MitchDresdner commented 3 years ago

Moving to latest flutter_svg solved the earlier issue:

pubspec.yaml

flutter_svg: ^0.19.1

flutter_svg: ^0.22.0

MitchDresdner commented 3 years ago

Oh crap ... the comment (pound sign) above was treated as Markdown when I saved

Use version 0.22.0 and issue is resolved.

jfschmakeit commented 3 years ago

Thanks for the very detailed report and for finding the solution!

I have a change currently out for review and hope to merge it as soon as possible.

For anyone else encountering this in the meantime, please update the dependency in the file pubspec.yaml as follows:

flutter_svg: ^0.22.0