草庐IT

definition-lists

全部标签

flutter - 类型 List<dynamic> 不是类型 'Map<String, dynamic>' 的子类型

我正在尝试从API获取数据。我收到错误消息“类型列表不是map的子类型。我是新手,不明白我在哪里犯了错误。这是我的fetchpost函数:FuturefetchPost()async{finalresponse=awaithttp.get('http://starlord.hackerearth.com/beercraft');if(response.statusCode==200){returnPost.fromJson(json.decode(response.body));}else{throwException('Failedtoloadpost');}}在我的主屏幕中,我使用

flutter ,飞镖 :io - convert Uint8List (from websocket) to a jpeg file I can draw

我写了一个简单的nodejsws客户端连接时提供二进制jpeg文件的websocket服务器如下:importWebSocket=require("ws");console.log("Websocketisstarting...");//Setupwebsocketconstwss=newWebSocket.Server({port:8080});wss.on("connection",functionconnection(webSocket){console.log("Connected");webSocket.on("message",functionincoming(messag

flutter ,飞镖 :io - convert Uint8List (from websocket) to a jpeg file I can draw

我写了一个简单的nodejsws客户端连接时提供二进制jpeg文件的websocket服务器如下:importWebSocket=require("ws");console.log("Websocketisstarting...");//Setupwebsocketconstwss=newWebSocket.Server({port:8080});wss.on("connection",functionconnection(webSocket){console.log("Connected");webSocket.on("message",functionincoming(messag

serialization - 如何将 List<Point> 保存到首选项中并从 flutter 中的首选项中获取 List<Point>?

使用时出错json_serializablejson_serializable:json_serializableon.../sign_point_model.dart:运行JsonSerializableGenerator时出错无法生成fromJsonvalList的代码因为类型Point.均未提供TypeHelper实例支持定义的类型。 最佳答案 json_serializable不知道如何将Point转换成JSON。因为您知道它只是一对num,所以您可以轻松地自己转换列表。import'dart:convert';voidma

serialization - 如何将 List<Point> 保存到首选项中并从 flutter 中的首选项中获取 List<Point>?

使用时出错json_serializablejson_serializable:json_serializableon.../sign_point_model.dart:运行JsonSerializableGenerator时出错无法生成fromJsonvalList的代码因为类型Point.均未提供TypeHelper实例支持定义的类型。 最佳答案 json_serializable不知道如何将Point转换成JSON。因为您知道它只是一对num,所以您可以轻松地自己转换列表。import'dart:convert';voidma

dart - C# Yield Return on Dart/Flutter Return List<String> 循环

我有以下方法:List>_buildGitIgnoreTemplateItems(){var_dropDownMenuItems=List>();_gitIgnoreTemplateNames.forEach((templateName){_dropDownMenuItems.add(DropdownMenuItem(child:Text(templateName),value:templateName,));});return_dropDownMenuItems;}我想要实现的是删除变量_dropDownMenuItems,例如:List>_buildGitIgnoreTemplat

dart - C# Yield Return on Dart/Flutter Return List<String> 循环

我有以下方法:List>_buildGitIgnoreTemplateItems(){var_dropDownMenuItems=List>();_gitIgnoreTemplateNames.forEach((templateName){_dropDownMenuItems.add(DropdownMenuItem(child:Text(templateName),value:templateName,));});return_dropDownMenuItems;}我想要实现的是删除变量_dropDownMenuItems,例如:List>_buildGitIgnoreTemplat

json - Flutter List<String> JSON 到 Widget

我在Assets文件夹中有一个JSON文件States.json{"name":"StateList","states":["Johor","Kedah","Kelantan","KualaLumpur","Melaka","NegeriSembilan","PulauPinang","Perak","Perlis","Pahang","Terengganu","Sabah","Sarawak","Selangor","WilayahPersekutuan"]}我为各州制作了一个模型类:state_model.dartclassStates{Stringname;Liststates;

json - Flutter List<String> JSON 到 Widget

我在Assets文件夹中有一个JSON文件States.json{"name":"StateList","states":["Johor","Kedah","Kelantan","KualaLumpur","Melaka","NegeriSembilan","PulauPinang","Perak","Perlis","Pahang","Terengganu","Sabah","Sarawak","Selangor","WilayahPersekutuan"]}我为各州制作了一个模型类:state_model.dartclassStates{Stringname;Liststates;

dart - flutter : Sort widget according to a sorted list of values

我目前有一个应用程序可以显示1.5公里半径内附近的医院,它看起来像这样:我遇到的问题是我无法弄清楚如何根据从最低到最高的计算距离对卡片进行排序。我做了一个ListdoubleList=[];存储计算距离的列表并使用doubleList.sort();对其进行排序.这是代码片段:returnnewListView.builder(shrinkWrap:true,itemCount:jsonresponse.length,itemBuilder:(context,index){Stringname=jsonresponse[index]["Name"];Stringlat=jsonresp