【发布时间】:2020-07-16 18:53:39
【问题描述】:
我正在努力将 Flutter Flappy 搜索栏连接到 firebase 集合。现在花了几天时间,似乎无法弄清楚。在控制台中出现以下错误:
VERBOSE-2:ui_dart_state.cc(157)] 未处理的异常:类型 “PlatformException”不是“Error”类型的子类型
我还在学习中,所以如果有人可以向我提供任何帮助,我将不胜感激。
class SellHousesPage extends StatelessWidget {
Database database;
House house;
Future<List<House>> getHouses(String name) async {
List houseList;
await Future.delayed(Duration(seconds: 2));
final List<DocumentSnapshot> documents =
(await Firestore.instance.collection('houses').getDocuments()).documents;
houseList = documents.map((documentSnapshot) => documentSnapshot[house.name]).toList();
return houseList;
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: SearchBar<House>(
onSearch: getHouses,
onItemFound: (House house, int index) {
return Container(
color: Colors.indigo,
child: ListTile(
title: Text(house.name),
),
);
},
),
),
),
);
}
}
【问题讨论】:
标签: flutter flutter-layout dart-pub