someone help me for this issu i can't solve this issu plz anyone help me..why show this prolem undifined the firestore but package i add it
class _ProductPageState extends State<ProductPage> {
@override
Widget build(BuildContext context) {
return Container(
child: StreamBuilder(
stream: Firestore.instance.collection("Sari").snapshots(),
builder: (_, snapshot) {
if (snapshot.hasData) {
return Center(child: Text('loading'));
} else {
return Container(
height: 320,
child: PageView.builder(
itemCount: 5,
itemBuilder: (_, position) {
return _buildPageItem(position);
}),
);
}
},
),
);
}
its pubspec.yml
cupertino_icons: ^1.0.2 firebase_auth: ^3.3.6 firebase_core: ^1.12.0 cloud_firestore: ^3.1.7 flutter_screenutil: ^5.1.1 fluttertoast: ^8.0.8 carousel_slider: ^4.0.0 dots_indicator: ^2.0.0
CodePudding user response:
You should add below line;
import 'package:cloud_firestore/cloud_firestore.dart';
or just follow Firestore installation documentation: https://firebase.flutter.dev/docs/firestore/overview
CodePudding user response:
Try this,
Use FirebaseFirestore.instance
instead of Firestore
.
CodePudding user response:
You have used the wrong identifier to reference Firestore. Use FirebaseFirestore.instance
instead of Firestore.instance
.
Here is the documentation for this: https://firebase.flutter.dev/docs/firestore/usage