草庐IT

dynamic-class

全部标签

firebase - flutter 错误 : type 'Future<dynamic>' is not a subtype of type 'List<Game>'

我正在尝试构建一个包含不同游戏列表的应用。作为后端,我使用Firebase并且连接工作正常,我对其进行了测试。无论如何,我在用来自firebase的真实数据替换模拟数据时遇到了问题。我总是收到此错误:type'Future'isnotasubtypeoftype'List'我有以下功能:getGames()async{ListnewGamesList=[];QuerySnapshotresult=awaitFirestore.instance.collection('products').getDocuments();Listdocuments=result.documents;doc

firebase - flutter 错误 : type 'Future<dynamic>' is not a subtype of type 'List<Game>'

我正在尝试构建一个包含不同游戏列表的应用。作为后端,我使用Firebase并且连接工作正常,我对其进行了测试。无论如何,我在用来自firebase的真实数据替换模拟数据时遇到了问题。我总是收到此错误:type'Future'isnotasubtypeoftype'List'我有以下功能:getGames()async{ListnewGamesList=[];QuerySnapshotresult=awaitFirestore.instance.collection('products').getDocuments();Listdocuments=result.documents;doc

flutter :- How to parse the JSON from the model class in flutter?

我在flutter中像下面的代码一样从键和值中解析JSONFuturelogin()async{varbody=json.encode({"MOB":"1112223330","KEY":"123456"});returnhttp.post(Uri.encodeFull("https://MY_Server/Users/login"),body:body.toString(),headers:{'Content-type':'application/json'}).then((response){print("ResponseStatus:$response");if(response

flutter :- How to parse the JSON from the model class in flutter?

我在flutter中像下面的代码一样从键和值中解析JSONFuturelogin()async{varbody=json.encode({"MOB":"1112223330","KEY":"123456"});returnhttp.post(Uri.encodeFull("https://MY_Server/Users/login"),body:body.toString(),headers:{'Content-type':'application/json'}).then((response){print("ResponseStatus:$response");if(response

list - 如何过滤 List<Map<String, dynamic>> 以获取 Flutter 中的值?

我有一个json数据,我正在加载到List>使用awaitjsonDecode.。例子,我有一个;金额=12500口径=24我需要过滤儿子以获得成熟度值:689.19此外,如果我有一个数量=12500和值(value)=689.19,我需要获得24口径。如何在Flutter中过滤List>json数据获取值?[{"amount":"5000","caliber":"12","maturity":"484.25"},{"amount":"5000","caliber":"24","maturity":"275.67"},{"amount":"7500","caliber":"12","m

list - 如何过滤 List<Map<String, dynamic>> 以获取 Flutter 中的值?

我有一个json数据,我正在加载到List>使用awaitjsonDecode.。例子,我有一个;金额=12500口径=24我需要过滤儿子以获得成熟度值:689.19此外,如果我有一个数量=12500和值(value)=689.19,我需要获得24口径。如何在Flutter中过滤List>json数据获取值?[{"amount":"5000","caliber":"12","maturity":"484.25"},{"amount":"5000","caliber":"24","maturity":"275.67"},{"amount":"7500","caliber":"12","m

RabbitMQ Failed to convert message.No method found for class java.lang.String问题解决

问题描述:        org.springframework.amqp.rabbit.support.ListenerExecutionFailedException:Failedtoconvertmessage        Causedby:org.springframework.amqp.AmqpException:Nomethodfoundforclassjava.lang.String问题分析:1、消息生产者发送的消息类型为String,消息消费者接收的消息类型为Message,导致接收的时候类型转换不对。@ComponentpublicclassMessageProvider{

class - 在 dart 中将 final 变量设为私有(private)是多余的吗?

下面的类有多个参数,但只有一些需要是final;我的问题是,我是否也应该将这些最终变量设为私有(private),或者这样做是否多余?classCar{finaldouble_galInFullTank;getgalInFullTank=>_galInFullTank;double_miDrivenToEmpty;getmiDrivenToEmpty=>_miDrivenToEmpty;double_mpg;getmpg=>_mpg;voidupdate(doublenewMiDrivenToEmpty){_miDrivenToEmpty=newMiDrivenToEmpty;_mpg

class - 在 dart 中将 final 变量设为私有(private)是多余的吗?

下面的类有多个参数,但只有一些需要是final;我的问题是,我是否也应该将这些最终变量设为私有(private),或者这样做是否多余?classCar{finaldouble_galInFullTank;getgalInFullTank=>_galInFullTank;double_miDrivenToEmpty;getmiDrivenToEmpty=>_miDrivenToEmpty;double_mpg;getmpg=>_mpg;voidupdate(doublenewMiDrivenToEmpty){_miDrivenToEmpty=newMiDrivenToEmpty;_mpg

class - 错误 "Can' t access this in a field initializer 是什么意思”?

我想在flutter中创建一个显示警告框的类,它可以将标题和内容作为输入来显示错误框。但是当我使用它来访问AlertDialog()中同一类的变量时,调试控制台说“无法在字段初始值设定项中访问它”。import'package:flutter/material.dart';voidmain()=>runApp(MaterialApp(home:Alert("SayHy","Hy"),));classAlertextendsStatelessWidget{finalStringtitlea;finalStringcontexta;Alert(this.titlea,this.contex