title: Access Object Data in Flutter
body: <p>I'm new to Flutter and trying to get some basics done. I would like to access data from an object on several places within my code.</p>
  
  <p>I'm most likely mixing up scope or variable types within oo code. So far I only used basic coding using javascript or php and never played to much with objects and stuff.</p>
  
  <p>Please see my sample code below:</p>
  
  <pre class="lang-dart prettyprint-override"><code>class _APPS extends State&lt;APP&gt;
      with SingleTickerProviderStateMixin {
  
    final pages = {
      "events": {
        "title": "Events",
        "icon": Icon(Icons.event),
        "page": EventsSite(),
      },
      "news": {
        "title": "News",
        "icon": Icon(Icons.message),
        "page": NewsSite(),
      },
      "favorites": {
        "title": "Favorites",
        "icon": Icon(Icons.favorite),
        "page": EventsSite(),
      },
      "profile": {
        "title": "Profile",
        "icon": Icon(Icons.account_circle),
        "page": EventsSite(),
      },
    };
  
    Widget build(BuildContext context) {
      return MaterialApp(
        home: Builder(
          builder: (context) =&gt; Scaffold(
            body: PageView(
              controller: _pageController,
              //physics: NeverScrollableScrollPhysics(),
              onPageChanged: _onPageChanged,
              children: [
                pages[0]['page'], &lt;=== Here is what i'm trying to do
                NewsSite(),
                Icon(Icons.directions_bike),
              ],
            ),
            bottomNavigationBar: BottomNavigationBar(
              type: BottomNavigationBarType.fixed,
              showUnselectedLabels: false,
              backgroundColor: _colorBackgroundBright,
              unselectedItemColor: Colors.white,
              selectedItemColor: _colorHighlight,
              selectedLabelStyle: TextStyle(fontSize: 10.0),
              iconSize: 20,
              currentIndex: _selectedIndex,
              onTap: _onItemTapped,
              items: const &lt;BottomNavigationBarItem&gt;[
                BottomNavigationBarItem(
                  icon: Icon(pages['Events']['icon']), &lt;=== Here is what i'm trying to do
                  title: Text(pages[0]['title']), &lt;=== Here is what i'm trying to do
                ),
                BottomNavigationBarItem(
                  icon: Icon(Icons.message),
                  title: Text('News'),
                ),
                BottomNavigationBarItem(
                  icon: Icon(Icons.favorite),
                  title: Text('Favorites'),
                ),
              ],
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/v0e4M.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v0e4M.png" alt="Screenshot with my intent and the error"></a></p>