Satrogan
Satrogan

Reputation: 489

How to downgrade packages in flutter?

cloud_firestore 0.12.11 isn't working for me in flutter, it won't allow my app to launch in debug. How would i downgrade this package? In the pubspec file I used a lower version of cloud_firestore ie. (cloud_firestore: ^0.12.9+4) and then saved and VS Code got the packages but when I try to launch again it gives the same error :

                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore- 
    0.12.11/ios/Classes/CloudFirestorePlugin.m:157:24: error: no visible @interface for 
    'FIRQuery' declares the selector 'queryWhereFieldPath:arrayContainsAny:'
                query = [query queryWhereFieldPath:fieldPath arrayContainsAny:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore- 
   0.12.11/ios/Classes/CloudFirestorePlugin.m:163:24: error: no visible @interface for 
   'FIRQuery' declares the selector 'queryWhereField:in:'
            query = [query queryWhereField:fieldName in:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore- 
   0.12.11/ios/Classes/CloudFirestorePlugin.m:165:24: error: no visible @interface for 
  'FIRQuery' declares the selector 'queryWhereFieldPath:in:'
                query = [query queryWhereFieldPath:fieldPath in:value];
                     ~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /Users/kev/flutter/.pub-cache/hosted/pub.dartlang.org/cloud_firestore- 
   0.12.11/ios/Classes/CloudFirestorePlugin.m:764:16: warning: 'timestampsInSnapshotsEnabled' 
    is deprecated [-Wdeprecated-declarations]
              settings.timestampsInSnapshotsEnabled = 
    (bool)call.arguments[@"timestampsInSnapshotsEnabled"];
                   ^
    In module 'FirebaseFirestore' imported from 

  /Users/kev/Documents/flutterprojects/shopapp/ios/Pods/Headers/Public/Firebase/Firebase.h:45:

 /Users/kev/Documents/flutterprojects/shopapp/ios/Pods/FirebaseFirestore/Firestore/Source/Public .   /FIRFirestoreSettings.h:69:20: note: 'timestampsInSnapshotsEnabled' has been explicitly marked 
    deprecated here
           __attribute__((deprecated));
                       ^
       1 warning and 4 errors generated.
       note: Using new build systemnote: Planning buildnote: Constructing build description
   Could not build the application for the simulator.
   Error launching application on iPhone X.

When i checked the flutter SDK inside of the .pubcache -> hosted -> pub.dartlang.org -> there is a folder in there cloud_firestore 0.12.11 how do i fix this? my applicatoin starts fine when i launch with cloud_firestore commented out in the pubspec file.

Upvotes: 13

Views: 15456

Answers (3)

PasPro
PasPro

Reputation: 75

If you have any packages in conflict, just put any instead of the version number at the end. Instead of flutter_hive: 1.0.0 you go like => flutter_hive: any. It will solve everything.

Upvotes: 2

Jonas357
Jonas357

Reputation: 288

yeah you need to remove the caret, but you also need to clean out those old (new) folders!

in the terminal window, you need to run "$ flutter clean" in the project root, and "$ flutter pub upgrade", and possibly delete the Pods/ folder and get everything reset from scratch.

Also might need to use "file/invalidate cache" (in android studio).

Upvotes: 0

pr0gramista
pr0gramista

Reputation: 9038

cloud_firestore: ^0.12.9+4

This little sign ^ called caret is used to tell the pub to get this version or higher. To pick a specific version you need to remove it.

cloud_firestore: 0.12.9+4

To learn more about dependencies visit Dart documentation about caret syntax and version constraints.

Upvotes: 54

Related Questions