title: How to change text every 24 hours in Dart
body: <p>So basically I am creating an app, and on the homepage of the app there is a "Quote of the Day". I have the quote already in a container but I can not get the quote to change every 24 hours.</p>
  
  <p>I am new to Dart, but using past knowledge on other programming languages, I figured I needed to use an if-else statement that also uses the device's internal clock. I was thinking that it would be "If(0:00 AM){display next quote in array} else{do nothing}".</p>
  
  <pre><code>import 'dart:async';
  
  void main () =&gt; runApp(MyApp());
  
  class MyApp extends StatelessWidget{
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        theme: ThemeData(primarySwatch: Colors.red),
        home: MainActivity(),
      );
    }
  }
  
  class MainActivity extends StatefulWidget {
    @override
    _MainActivityState createState() =&gt; _MainActivityState();
  }
  
  class _MainActivityState extends State&lt;MainActivity&gt;
  {
    String _timeString;
  
    @override
    void initState(){
      _timeString = "${DateTime.now().hour} : ${DateTime.now().minute}";
      Timer.periodic(Duration(seconds:1), (Timer t)=&gt;_getCurrentTime());
      super.initState();
    }
  
  @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Container(
          decoration: new BoxDecoration(
                image: new DecorationImage(
                  image: new AssetImage('assets/Day.png'),
                  fit: BoxFit.cover,
                ),
              ),
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
            new Center(
              child:new Container(
                width: 200.0,
                height: 100.0,
                decoration: new BoxDecoration(
                  shape: BoxShape.rectangle,
                  color: Colors.white.withOpacity(0.7),
                  borderRadius: new BorderRadius.circular(10.0),
                  boxShadow: [
                    new BoxShadow(
                      color: Colors.black26,
                      offset: new Offset(5.0, 5.0),
                      blurRadius: 5.0
                    ),
                  ]
                ),
              child: new Center(
                child: new Text(
                  _timeString,
                  style: new TextStyle(
                    color: Colors.white,
                    fontFamily: 'Open Sans',
                    fontSize: 50
                  ),
                ),
              ),
              ),
            ),
            SizedBox(height: 300),           
            new Container(
                width: 345.0,
                height: 120.0,
                decoration: new BoxDecoration(
                  shape: BoxShape.rectangle,
                  color: Colors.white.withOpacity(0.7),
                  borderRadius: new BorderRadius.circular(10.0),
                  boxShadow: [
                    new BoxShadow(
                      color: Colors.black26,
                      offset: new Offset(5.0, 5.0),
                      blurRadius: 5.0
                    ),
                  ]
                ),
              child: new Center(
                child: new Text(
                  '“Morning is an important time of day, because how you spend your morning can often tell you what kind of day you are going to have.”\n\t ― Lemony Snicket, The Blank Book',
                  style: new TextStyle(
                    color: Colors.white,
                    fontFamily: 'Playfair Display'
                  ),
                ),
              ),
              ),
              ],
            ),
          ),
        ),
      );
    }
  
   void _getCurrentTime()  {
      setState(() {
    _timeString = "${DateTime.now().hour} : ${DateTime.now().minute}";
      });
    } 
  }
  </code></pre>
  
  <p>No matter how many times I try, this approach doesn't work, but that may be due to my limited knowledge. Any bit of information helps.</p>