title: S.of(context) return null
body: <p>Version 1:</p>
  
  <pre><code> @override
    void initState() {
      super.initState();
  
      slides.add(
        new Slide(
          title: S.of(context).intro_title_first,
          description: S.of(context).intro_description_first,
          pathImage:"images/image1",
  
          /*pathImage: "assets/images/intro_1.xml",*/
  
          backgroundColor: Color(0xfff5a623),
        ),
      );
  }
  </code></pre>
  
  <p>When I run this code, I got error :</p>
  
  <pre><code>I/flutter ( 9492): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
  I/flutter ( 9492): The following assertion was thrown building Builder:
  I/flutter ( 9492): inheritFromWidgetOfExactType(_LocalizationsScope) or inheritFromElement() was called before
  I/flutter ( 9492): IntroScreenState.initState() completed.
  I/flutter ( 9492): When an inherited widget changes, for example if the value of Theme.of() changes, its dependent
  I/flutter ( 9492): widgets are rebuilt. If the dependent widget's reference to the inherited widget is in a constructor
  I/flutter ( 9492): or an initState() method, then the rebuilt dependent widget will not reflect the changes in the
  I/flutter ( 9492): inherited widget.
  I/flutter ( 9492): Typically references to inherited widgets should occur in widget build() methods. Alternatively,
  I/flutter ( 9492): initialization based on inherited widgets can be placed in the didChangeDependencies method, which
  I/flutter ( 9492): is called after initState and whenever the dependencies change thereafter.
  </code></pre>
  
  <p>So after searching on stack overflow, I got <a href="https://stackoverflow.com/a/53778609/1640009">this link</a>, </p>
  
  <p>then code becomes:</p>
  
  <p>Version 2:</p>
  
  <pre><code>@override
    void initState() {
      super.initState();
  
      Future.delayed(const Duration(milliseconds: 500), () {
        setState(() {
          // Here you can write your code for open new view
  
          slides.add(
            new Slide(
              title: S.of(context).intro_title_first,
              description: S.of(context).intro_description_first,
              pathImage:"images/image1",
  
              /*pathImage: "assets/images/intro_1.xml",*/
  
              backgroundColor: Color(0xfff5a623),
            ),
          );
  
        });
      });
  
    }
  </code></pre>
  
  <p>Then I got error:</p>
  
  <pre><code>The following assertion was thrown building IntroSlider(dirty, dependencies: [MediaQuery,
  I/flutter ( 9492): _LocalizationsScope-[GlobalKey#bb3bb]], state: IntroSliderState#f24e7(ticker inactive)):
  I/flutter ( 9492): 'package:flutter/src/widgets/container.dart': Failed assertion: line 267 pos 15: 'margin == null ||
  I/flutter ( 9492): margin.isNonNegative': is not true.
  I/flutter ( 9492): 
  </code></pre>
  
  <p>Questions:</p>
  
  <ol>
  <li>In the version 1 code, I believe I am getting error because buildContext is not available till then, but as <a href="https://flutterbyexample.com/stateful-widget-lifecycle/#3-initstate" rel="nofollow noreferrer">mentioned here</a>, in initstate method if mounted then buildContext is there.</li>
  <li>In the version 2 code,S.of(context) is returning null.   </li>
  </ol>
  
  <p>Blockquote</p>