0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

flutter_hooksで配列に値を加えて変更を画面に反映する方法

Posted at

この記事を書こうと思ったわけ

sample.dart
final list = useState(<int>[]);
// ... 省略
onPressed: () => list.value.add(0);

と記述しても変更が反映されませんでした。

結論

sample.dart
final list = useState(<int>[]);
// ... 省略
onPressed: () =>list.value = List.from(list.value)..add(0);

成功しました

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?