草庐IT

weak_ptr_cast

全部标签

json - 错误 : Type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>' in type cast

我是Flutter的新手,我尝试从“10.0.2.2:8000/api/membres”上的api获取数据,但出现错误,如typeListdynamicisnotasubtypeoftype'List.我正在关注flutter的示例:https://flutter.dev/docs/cookbook/networking/fetch-data#complete-example请帮助我遵循有用的教程并告诉我如何修复此代码。我的主页.dartimport'package:flutter/material.dart';import'dart:async';import'package:htt

flutter - 当我尝试登录或注册时,出现错误 "Error type ' AuthResult' is not a subtype of type 'FirebaseUser' in type cast"

我正在为我的大学项目制作一个flutter应用程序,我在其中添加了一个登录和注册页面并通过Firebase对其进行了身份验证,当我单击登录时调试控制台显示“错误类型‘AuthResult’是不是类型转换中“FirebaseUser”类型的子类型”,当我在此错误后重新加载应用程序时,它成功登录。在此更新后将firebase_auth包更新到0.12.0之前,一切都运行良好,方法“signInWithEmailAndPassword()”和“createUserWithEmailAndPassword()”抛出错误“A“AuthResult”类型的值不能分配给“FirebaseUser”类

sql - 如何在sqlite3中输入cast

我在命令提示符下运行了sqlite3并运行了一些基本的SQL命令。user@comp:~$sqlite3SQLiteversion3.8.22013-12-0614:53:30Enter".help"forinstructionsEnterSQLstatementsterminatedwitha";"sqlite>CREATETABLEA(aint,btext,cfloat);sqlite>INSERTINTOA(a,b,c)VALUES(1,'2',3);sqlite>SELECTb::int+2FROMA;除了最后一行,所有行都有效,它给出了错误:`Error:unrecogniz

c# - 列中的 NULL 值出现 Dapper Cast 异常

我正在使用SQLite及其闭包扩展来存储层次结构。非闭包表创建为_connection.Execute(@"CREATETABLEIFNOTEXISTScategory(idINTEGERNOTNULLPRIMARYKEY,nameTEXT,parent_idINTEGER,FOREIGNKEY(parent_id)REFERENCEScategory(id));");插入根节点时parent_id设置为NULL。Dapper来回转换的类是publicclassTestRecord{publiclongid;publicstringname;publiclong?parent_id;}

RedisSystemException : java. lang.ClassCastException : [B cannot be cast to java. lang.Long

我在多线程环境下使用jedis和spring-data-redis时遇到这个异常:org.springframework.data.redis.RedisSystemException:Unknownredisexception;nestedexceptionisjava.lang.ClassCastException:[Bcannotbecasttojava.lang.Longatorg.springframework.data.redis.FallbackExceptionTranslationStrategy.getFallback(FallbackExceptionTransl

swift - 引用 [weak self] 作为自己? animateWithDuration 内部导致崩溃

如果我在闭包上声明[weakself]并在UIView.animateWithDuration中将self引用为self?>应用会崩溃:someFunc(){[weakself](success)->VoidinUIView.animateWithDuration(0.25){self?.someView.alpha=1;}}使用消息发送到释放的实例但如果我有选择地提前解包self它不会someFunc(){[weakself](success)->Voidinifletweakself=self{UIView.animateWithDuration(0.25){weakself.so

swift - 内部闭包的捕获列表是否需要将 `self` 重新声明为 `weak` 或 `unowned`?

如果我有一个闭包传递给这样的函数:someFunctionWithTrailingClosure{[weakself]inanotherFunctionWithTrailingClosure{[weakself]inself?.doSomething()}}如果我在someFunctionWithTrailingClosure的捕获列表中将self声明为[weakself]而没有在捕获列表中再次将其重新声明为weakanotherFunctionWithTrailingClosureself已经变成了Optional类型,但它是否也变成了weak引用?谢谢!

casting - Swift 中的 float 划分和类型转换

我正在努力学习Swift,我做了一个简单的平均函数:funcaverage(numbers:Int...)->Float{varsum=0fornumberinnumbers{sum+=number}returnFloat(sum)/Float(numbers.count)}average(1,2,3,4,5,6)这给了我正确的结果:3.5但是,我想知道为什么我必须将sum和numbers.count都转换为float。我试过这样转换:returnFloat(sum/numbers.count)但它只给了我3.0 最佳答案 首先,您

closures - 为什么 [weak self] 有效但 [unowned self] 在 Swift 闭包中中断?

此SpriteKitAction通过使用完成闭包调用自身来重复。它使用闭包,而不是SKAction.repeatActionForever(),因为它需要在每次重复时生成一个随机变量:classTwinkler:SKSpriteNode{init(){super.init(texture:nil,color:UIColor.whiteColor(),size:CGSize(width:10.0,height:10.0))twinkle()}functwinkle(){letrand0to1=CGFloat(arc4random())/CGFloat(UINT32_MAX)letacti

casting - Swift:CInt 到 Int 的转换?

在Swift中将CInt转换为Int(原生整数类型)的最简洁方法是什么?现在我正在使用:NSNumber.numberWithInt(myCInt).integerValue这是首选方法吗? 最佳答案 你可以这样做:varc:CInt=4vari:Int=Int(c)CInt是Int32的类型别名,它是Int可以在其初始化中接受的类型之一。以下是我发现可以这样使用的类型:UInt8、Int8、UInt16、Int16、UInt32、Int32、UInt64、Int64、UInt、Float、Double、Float80