未为类型“problemModel”定义方法“toLowerCase”。尝试将名称更正为现有方法的名称,或定义名为“toLowerCase”的方法。
class _view_problemState extends State<view_problem> {
List<problemModel> problemlist = [];
StreamController _streamController = StreamController();
Future getAllProblem() async {
problemlist = await problemcontrollers().getProblem();
_streamController.sink.add(problemlist);
}
@override
void initState() {
// TODO: implement initState
Timer.periodic(Duration(seconds: 1), (timer) {
getAllProblem();
});
super.initState();
}
void _filterSearch(String query) {
List<problemModel> duplicateItems = [];
setState(() {
problemlist = duplicateItems
.where((problemlist) =>
problemlist.toLowerCase().contains(query.toLowerCase()))
.toList();
});
}
1条答案
按热度按时间k4aesqcs1#
toLowerCase()仅用于String。你的problemlist不是String,而是problemModel对象。
阅读更多信息https://api.flutter.dev/flutter/dart-core/String/toLowerCase.html