草庐IT

ios - 是否可以覆盖 NSManagedObject 子类中@dynamic 属性的 getter 和 setter?

所以,我的场景是这样的:我的iOS应用程序中有一个NSManagedObject子类,作为一个属性,我想存储MKPolygon对象的内容。我决定解决这个问题的方法(它是否有效可能是一个不同的问题)是将多边形属性声明为可转换对象,然后存储一个包含多边形点的NSArray(作为NSValue对象)。为此,我在我的模型对象上编写了几个方便的类方法:+(NSArray*)coordsArrayFromMKPolygon:(MKPolygon*)polygonpointCount:(int)count{CLLocationCoordinate2D*coords=(CLLocationCoordi

post - 发送 post 请求时类型 'int' 不是类型转换中类型 'String' 的子类型

发送发布请求时出现奇怪的错误。//thismapispassedtoafunctionfinalMapactivityData={"userId":1,"name":activityName.text,"description":activityDescription.text,"startAt":activityStartAt.text,"endsAt":activityEndAt.text,"lat":_latitude,"long":_longitude,"category":2,"status":"pending"};//thiscodebellowisinsideaasync

flutter - 类型 'Future<dynamic>' 不是类型 'Future<List<History>>' 的子类型

使用这段代码已经有一段时间了,试图在flutter中创建一个历史数据库。似乎找不到Future的问题。如有任何帮助,我们将不胜感激!提前致谢!import'dart:convert';HistoryhistoryFromJson(Stringstr){finaljsonData=json.decode(str);returnHistory.fromJson(jsonData);}StringhistoryToJson(Historydata){finaldyn=data.toJson();returnjson.encode(dyn);}classHistory{intid;String

flutter - `Future<Stream>` 不是类型 `Stream` 的子类型

我制作了简单的单例类以在flutter上使用StreamBuilder小部件,例如:StreamBuilder(stream:MydbModel.create().then((dao)=>dao.getUserStream())asStream,builder:(_,snapshot){...},)在那个MydbModel.create().then((dao)=>dao.getUserStream())返回Future>我的类型转换不工作只有Stream.错误:>type'Future>'isnotasubtypeoftype'Stream'intypecast我该如何解决这个问题?

flutter - 快照错误类型 'int' 不是类型 'String' 的子类型

我正在尝试使用FutureBuilder获取数据并显示。fetch调用后显示type'int'isnotasubtypeoftype'String'这是我的json模型:classFeatured{finalintid;finalStringshop_type;finalStringname;finalStringname_bn;finalStringprice;finalStringprice_bn;finalboolold_price;finalStringold_price_val;finalStringold_price_val_bn;finalStringimage;Feat

flutter - 类型 'GeoPoint' 不是 flutter firestore 中类型 'String' 的子类型

我正在尝试googlemapsflutterwithfirestore但出了点问题。这是我的代码classStoreMapextendsStatelessWidget{constStoreMap({Keykey,@requiredthis.documents,@requiredthis.initialPosition,@requiredthis.mapController,}):super(key:key);finalListdocuments;finalLatLnginitialPosition;finalCompletermapController;@overrideWidgetb

flutter - 出现错误——类型 'SocketException' 不是类型 'widget' 的子类型

我的应用程序在笔记本电脑上正常工作意味着在模拟器中但在安卓手机上不正常。当我添加JSON连接时出现此错误。请帮助我解决它。Android屏幕截图(它在android中不起作用)IOS工作截图(它在ios中工作)有人告诉我添加下面的代码staticconstMapheader={'Content-type':'application/json','Accept':'application/json',};试过了,但还是不行。import'package:flutter/material.dart';import'package:xxxxxxxx/product_page.dart';im

flutter - 我无法将父类转换为 Dart 中的子类

我正在使用Flame在Flutter中构建2D游戏,但我遇到了CAST问题。import'dart:ui';classBarrierRectextendsRect{BarrierRect.fromLTWH(doubleleft,doubletop,doublewidth,doubleheight):super.fromLTWH(left,top,width,height);bool_barrier=true;boolgetisBarrier{returnthis._barrier;}setisBarrier(boolisBarrier){this._barrier=isBarrier;

flutter - 类型 'Future<dynamic>' 不是类型转换中类型 'List<dynamic>' 的子类型

我试图从我的firestore中获取确定集合中的所有文档,之后,我想将它们设置在文档列表中,列表的每个位置代表一个文档。但是,当我编写代码时,我收到了这个错误:类型“Future”不是类型转换中类型“List”的子类型import'package:cloud_firestore/cloud_firestore.dart';classRestaurant{Stringkeyword;Stringstate;Stringaddress;Stringcity;intevaluation;Stringimage;Stringphone;doublerating;Stringschedule;S

asynchronous - Flutter Future<dynamic> 与 Future<String> 子类型错误?

我刚刚更新了Flutter,并成功地从git下载了我的原始项目。现在我遇到了一个奇怪的Future错误。我在github上看到在线提到它,但没有关于如何修复的明确答案。该项目甚至不加载。它从我的main.dart文件中读取Future语句并返回这个...[VERBOSE-2:dart_error.cc(16)]Unhandledexception:type'Futuredynamic'isnotasubtypeoftype'FutureString'whereFutureisfromdart:asyncFutureisfromdart:asyncStringisfromdart:cor