HseyinAkkaya import ‘package:flutter/material.dart’;
import ‘package:firebase_core/firebase_core.dart’;
import ‘package:cloud_firestore/cloud_firestore.dart’;
class MyHomePage extends StatefulWidget {
final firestore = FirebaseFirestore.instance;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
CollectionReference moviesRef = firestore.collection(‘movies’);
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey,
appBar: AppBar(
backgroundColor: Colors.black,
title: Center(
child: Text(
‘FireBase’,
style: TextStyle(color: Colors.white, fontSize: 20),
),
),
),
body: Center(
child: Container(
child: Text(‘${moviesRef.id}’),
),
),
);
}
}
hocam sayfanın en basit hali bu ama ' CollectionReference moviesRef = firestore.collection(‘movies’);' kısmında firestore
a undefined diyor. Önerdiği şeyler de:
static get firestore => null;
static var firestore;
Sorun kısaca şu ben tanımladığım değişkeni kullanamıyorum.