3
3

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 5 years have passed since last update.

Flutter, Dartでタイマー表示する

Posted at

コード

initState()の中で処理をぶん回す

入れるコード

  var _now = DateTime.now();

  @override
  void initState() {
    super.initState();
    Timer.periodic(
        Duration(milliseconds: 1),
        (Timer t) => setState(() {
              _now = DateTime.now();
            }));
  }

コードを入れる箇所

image.png

Textで時間を表示する

入れるコード

Text('$_now'),

コードを入れる箇所

image.png

こんな感じになる

image.png

3
3
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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?