【发布时间】:2020-08-27 13:17:57
【问题描述】:
我想在小部件从网络加载数据时更改变量值,
只想做这样的事情:
_playid = _notes[1].id;
title = _notes[1].title;
但是无论我把它放在哪里,我都会得到一个错误,
我试图在 listview builder 中将其置于 set 状态,但没有运气,因为我不希望它与 onPress 或 on tap 方法一起使用
有人可以帮忙吗?
【问题讨论】:
-
错误是什么?
-
当我把它放在 listview.builder 下时(它说:错误:位置参数太多:预期为 0,但找到了 1。(extra_positional_arguments_could_be_named at [music] lib\pages\playerPage.dart:210)但如果我把它放在两者之间它不会给出任何错误: itemBuilder: (context, index) { title = _notes[1].title; //这是我想要改变的 return GestureDetector( 但是它不会改变变量值在那里。我正在尝试的是在json返回数据时设置默认值
标签: flutter flutter-layout flutter-dependencies flutter-test