Here is my code, slightly adapted from the example in flutter documentation:
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
@override
Widget build(BuildContext context) {
CollectionReference items = FirebaseFirestore.instance.collection('item');
return FutureBuilder<DocumentSnapshot>(
future: items.doc(itemId).get(),
builder:
(BuildContext context, AsyncSnapshot<DocumentSnapshot> snapshot) {
if (snapshot.hasError) {
return Text("Something went wrong");
}
if (snapshot.connectionState == ConnectionState.done) {
Map<String, dynamic> data = snapshot.data.data();
return data['out_of_stock_location_ids'];// ${data['last_name']}");
}
return Text("loading");
},
);
}
The code "FirebaseFirestore" is giving an error as it's not recognized as part of library that I'm imported. The import 'package:firebase_core/firebase_core.dart'; is grayed out, possibly inappropriately so. I can't find where on the internet I can find why this is occurring or what to do about it.