null safety

This commit is contained in:
phyothandar
2021-09-10 15:22:11 +06:30
parent 51a5fe0740
commit c90661b262
24 changed files with 194 additions and 193 deletions

View File

@@ -35,7 +35,7 @@ class _MarketEditorState extends State<MarketEditor> {
children: <Widget>[
Expanded(
child: new Text(
p.name,
p.name ?? "",
style: TextStyle(
fontSize: 15.0,
),
@@ -117,7 +117,7 @@ class _MarketEditorState extends State<MarketEditor> {
});
MarketModel marketModel = Provider.of<MarketModel>(context, listen: false);
try {
await marketModel.deleteMarket(market.id);
await marketModel.deleteMarket(market.id!);
} catch (e) {
showMsgDialog(context, "Error", e.toString());
} finally {

View File

@@ -20,14 +20,14 @@ class MarketModel extends BaseModel {
try {
if (listener != null) listener.cancel();
listener = Firestore.instance
listener = FirebaseFirestore.instance
.collection("/$config_collection/$setting_doc_id/$markets_collection")
.snapshots()
.listen((QuerySnapshot snapshot) {
markets.clear();
markets = snapshot.documents.map((documentSnapshot) {
markets = snapshot.docs.map((documentSnapshot) {
var user = Market.fromMap(
documentSnapshot.data, documentSnapshot.documentID);
documentSnapshot.data as Map<String, dynamic>, documentSnapshot.id);
return user;
}).toList();
notifyListeners();