Android 赢得的数据';不能在颤振中异步加载

Android 赢得的数据';不能在颤振中异步加载,android,flutter,dart,Android,Flutter,Dart,我的颤振应用程序中有两个页面。在一个页面中,我检查SQLite数据库中是否存在数据,该数据是否加载到页面中,如果不存在,则从API获取数据并显示。第二页的过程也与第一页相似 首页 类NewsBloc扩展BlocBase{ 最终通知存储库; DatabaseHelper=DatabaseHelper(); int _page=0; int _极限=20; int currentCategory; 映射_categories=Map(); 字符串搜索猫; 字符串类别; List _categori

我的颤振应用程序中有两个页面。在一个页面中,我检查SQLite数据库中是否存在数据,该数据是否加载到页面中,如果不存在,则从API获取数据并显示。第二页的过程也与第一页相似

首页


类NewsBloc扩展BlocBase{
最终通知存储库;
DatabaseHelper=DatabaseHelper();
int _page=0;
int _极限=20;
int currentCategory;
映射_categories=Map();
字符串搜索猫;
字符串类别;
List _categoriesnamesearch=List();
List _categoriesNames=List();
List _newsInner=List();
bool_fnish=true;
bool_first=true;
新闻集团(this.repository){}
@凌驾
void initView()异步{
List categories=await helper.getCategoriList();
如果(categories.isNotEmpty&&categories.length>0){
对于(变量i=0;i0){
_showNews(allNws,false);
}
streams.progress.set(true);
var newsche=await repository.getNewsCat(
今天,_page.toString(),searchCat,_limit.toString());
如果(newsche.length>0){
wait helper.deleteNews(_限制);
}
如果(newsche.length>0){
for(var i=0;i0){
_showNews(allNws,false);
}
streams.progress.set(true);
var newsche=await repository.getNewsAll(
今天,_page.toString(),_limit.toString());
如果(newsche.length>0){
wait helper.deleteNews(_限制);
}
如果(newsche.length>0){
for(var i=0;i