Skip to content

[shared_preferences] Variable binding in a condition requires an initializer #129983

@amit-agendaboa

Description

@amit-agendaboa

Is there an existing issue for this?

Steps to reproduce

Add shared_preferences: 2.2.0 in dependencies.

Expected results

should working fine.

Actual results

I am getting this error after updating to shared_preferences: 2.2.0.

Swift Compiler Error (Xcode): Variable binding in a condition requires an initializer
/Users/appleapple/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.0/darwin/Classes/SharedPreferencesPlugin.swift:57:21

Uncategorized (Xcode): Command CompileSwiftSources failed with a nonzero exit code

Could not build the application for the simulator.
Error launching application on iPhone SE (3rd generation).

Code sample

Code

shared_preferences: 2.2.0

Screenshots or Video

Screenshots / Video demonstration Screen Shot 2023-07-05 at 12 23 58 PM Screen Shot 2023-07-05 at 12 21 14 PM

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.5, on macOS 12.6.7 21G651 darwin-x64, locale en-US)
    • Flutter version 3.10.5 on channel stable at /Users/appleapple/Documents/flutterSdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (3 weeks ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/appleapple/Library/Android/sdk
    • Platform android-33, build-tools 32.1.0-rc1
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 13E500a
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)

[✓] Connected device (5 available)
    • Redmi Y2 (mobile)                   • 73e697d                              • android-arm    • Android 9 (API 28)
    • iPhone (mobile)                     • 00008020-001C4D3E0E52002E            • ios            • iOS 13.4.1 17E262
    • iPhone SE (3rd generation) (mobile) • DB6CD68A-5CED-4D74-A2E7-FFA249CC9A18 • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-15-4 (simulator)
    • macOS (desktop)                     • macos                                • darwin-x64     • macOS 12.6.7 21G651
      darwin-x64
    • Chrome (web)                        • chrome                               • web-javascript • Google Chrome 114.0.5735.198

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work lista: buildBuilding flutter applications with the toolc: regressionIt was better in the past than it is nowp: shared_preferencesPlugin to read and write Shared Preferencespackageflutter/packages repository. See also p: labels.platform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions