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?

FlutterのStateful Widgetの理解を深める

Posted at

値が変更されたときに、UIを更新してほしいWidgetを作る時に使うのがState。

StatefulWidget を継承したWidgetと
State を継承したデータ
を作成することで、Stateを元にUIが作成される。

StatefulWidgetを継承したクラスの作成

class MyWidget extends StatefulWidget {
  @override
  // インスタンスの作成
  _MyWidgetState createState() => _MyWidgetState();
}

Stateを継承したクラスの作成

// クラスのインスタンス化で生成したStateを継承して使う
class _MyWidgetState extends State<MyWidget> {
  // データを宣言
  int count = 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?