草庐IT

update_state

全部标签

dart - flutter 和 Firestore : How can access variables from Stateful Widget to create a new document?

我想在StatelessWidget中使用StatefulWidget的最终变量在Firestore中创建一个新文档。但我总是遇到同样的问题:在初始化器中只能访问静态成员我的StatefulWidget代码:classUserProfileextendsStatefulWidget{UserProfile({this.auth,this.onSignedOut,this.userID});finalBaseAuthauth;finalVoidCallbackonSignedOut;finalStringuserID;@override_UserProfileStatecreateSta

dart - 如何在 flutter https ://key:secret@payment. api/payments/transactionid/update 中调用 URL

如何像这样调用urlhttps://key:secret@payment.api/payments/transactionid/update,我已经调用了http.get(Uri.parse"https://key:secret@payment.api/payments/transactionid/update");但出现以下错误。E/flutter(8892):[ERROR:flutter/shell/common/shell.cc(181)]Dart错误:未处理的异常:E/flutter(8892):FormatException:无效端口 最佳答案

android - Android的RecyclerView.SCROLL_STATE_IDLE在Flutter中相当于什么

Android提供类似RecyclerView.SCROLL_STATE_IDLE的滚动状态,告诉用户何时停止滚动。我无法在Pageview或ListViewScrollListener的flutter中找到任何alternative。我的问题我需要在PageView中检测向上/向下滚动以执行一些基于此的操作。Flutter给出了方向(_myPageViewController.position.userScrollDirection)但它给出了一个连续的回调。我只需要在用户停止滚动时检测它。另一种情况我需要在ListView中自动播放视频。所以我需要检测用户何时停止滚动,然后获取位置

dart - 如何在 Flutter 的 State 中使用 2 个 mixin?

我有一个州级classListScreenStateextendsState...我想使用AutomaticKeepAliveClientMixin(以防止处理这些屏幕的TabBar)和TickerProviderStateMixin,因为我有需要它的动画Controller。但是当我将两个mixin都放在这个类中时,会出现错误:error:Typeparameterscouldnotbeinferredforthemixin'TickerProviderStateMixin'becausethebaseclassimplementsthemixin'ssupertypeconstra

flutter - 为什么即使 Widget 不可见,State 的 build() 方法仍会被调用?

这个Flutter应用示例由一个抽屉和两个可以使用抽屉导航的“页面”(脚手架)组成:import'package:flutter/material.dart';classMyTestDrawerextendsStatefulWidget{@override_MyTestDrawerStatecreateState()=>new_MyTestDrawerState();}class_MyTestDrawerStateextendsState{@overrideWidgetbuild(BuildContextcontext){returnnewDrawer(child:newListVie

Dart http : "Bad state: Can' t finalize a finalized Request"when retrying a http. 获取新访问 token 后的请求

我目前正在尝试访问Flutter中的WebAPI,它需要JWT访问token进行授权。访问token在一定时间后过期。可以使用单独的刷新token请求新的访问token。现在,一旦请求返回401响应,就会执行此访问token刷新。之后,应使用新的访问token重试失败的请求。我在最后一步遇到了问题。似乎http.BaseRequest只能发送一次。我将如何使用新token重试http请求?如darthttpreadme中的建议,我创建了一个http.BaseClient的子类来添加授权行为。这是一个简化版本:import'dart:async';import'package:http/

android - Android 中的 Sugar ORM : update a saved object in SQLite

我是在Android上使用SQLite和SugarORM进行应用程序开发的新手,并试图通读SugarORM文档,但没有找到任何关于如何更新SQLite中保存的对象的信息。更改其属性后是否仍可以保存对象?像这样的东西:CustomermyCustomer=(Customer.find(Customer.class,"id=?",id)).get(0);myCustomer.setName("newname");myCustomer.setAddress("newAddress");myCustomer.save();//isthisokayforupdatingtheobject?sav

sql - 在 SQLite UPDATE 中模拟 ORDER BY 来处理唯一性约束

我在SQLite3中有一个表:sqlite>.schemaCREATETABLEtable1(idINTEGERPRIMARYKEYNOTNULL,titleTEXTUNIQUENOTNULL,priorityINTEGERUNIQUENOTNULL);这里是一些示例数据,用于说明:sqlite>SELECT*FROMtable1;idtitlepriority------------------------------1a12b23c34d4我希望将所有priority>1的单元格的priority加1。这是我的第一次尝试:sqlite>UPDATEtable1SETpriority

c# - Sqlite "Update"C#语法错误

嗨,下面的代码给出了一个语法错误。我不知道如何解决这个问题。错误{"SQLiteerror\r\nnear\"Mytext\":syntaxerror"}我的代码stringdataSource="Database.s3db";SQLiteConnectionconnection=newSQLiteConnection();connection.ConnectionString="DataSource="+dataSource;connection.Open();SQLiteCommandcommand=newSQLiteCommand(connection);command.Comm

sql - sqlite3 是否支持触发器自动更新 'updated_on' 日期时间字段?

我有一个看起来像这样的表user_id|name|created_on|updated_on--------------------------------------------------1|PeterD|1/1/2009|如果我插入或更新一条记录,我想要一个触发器来使用datetime('now')更新updated_on字段。但是我找不到函数名称来定位sqlite3中最近更新的行。有吗? 最佳答案 CREATETRIGGERyour_table_trigAFTERUPDATEONyour_tableBEGINupdateyo