The Error “error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore”, is an error that is invoked whenever you are trying to build an app with flutter and trying to use the firestone capabilites.
Given below is the snippet of the error you might get:
error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore
I would like to share with you the steps I took to fix the “error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore” in your project file.
Why “error cannot find symbol import com google firebase firestore TransactionOptions symbol class TransactionOptions location package com google firebase firestore” Error is Seen?
The error, “error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore” is seen because might be you are using a lower SDK version in your project, so first you will have to update your SDK version.
The error is also seen if firebase_core
dependency in pubspec.yaml is not updated.
The detailed solution to fix the error “error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore”, is given below:
How to fix “error cannot find symbol import com google firebase firestore TransactionOptions symbol class TransactionOptions location package com google firebase firestore”?
To fix the error, you will have to make sure that you are using an updated version of SDK which is compatible with your system. Then you will have to make sure that you are using updated the firebase_core
dependency in pubspec.yaml. using the firebase_core: ^1.20.0
version works to fix the error.
To fix the error, “error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore”, you have to follow the below mentioned steps:
You will have to make sure that you are using updated the firebase_core
dependency in pubspec.yaml. Using firebase_core: ^1.20.0
works to fix the error.
Please make sure that you run the code flutter clean
before and after updating your firebase_core.
This should fix the error, “error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore”.
Conclusion
To fix the error “error: cannot find symbol import com.google.firebase.firestore.TransactionOptions; symbol: class TransactionOptions location: package com.google.firebase.firestore”, you will have to make sure that you are using an updated version of SDK which is compatible with your system.
Then you will have to make sure that you are using updated the firebase_core
dependency in pubspec.yaml. using the firebase_core: ^1.20.0
version works to fix the error.