title: Updating a Map in Dart
body: <p>Alright, i have a big issue with this.
  Most of the Questions with similar issues, didn't quite help me cause they had a very different approach.</p>
  
  <p>I'm trying to edit the data in a Profile. Im using a Map to access the Data.</p>
  
  <p>Now when i try to set the new Map an Error appears: "Only static members can be accessed in initializers."</p>
  
  <p>i show you all the code. its not everything and i changed some parts to see better what i mean. i hope you guys understand it.</p>
  
  <pre><code>class Tabs extends StatefulWidget {
    Tabs({this.infos});
  
    final Map&lt;String, dynamic&gt; info;
  
    @override
    State&lt;StatefulWidget&gt; createState() {
      return _Tabs();
    }
  }
  
  class _Tabs extends State&lt;Tabs&gt; {
    int _currentIndex = 0; //Bottom Navigation
  
  
    final List&lt;Widget&gt; _children = [
      MaterialApp(
        theme: ThemeData(
          primaryColor: Colors.white,
          primaryColorDark: Colors.cyan[700],
          primaryColorLight: Colors.cyan[200],
          accentColor: Colors.deepOrange[200],
        ),
        home: Suche(), //not important..
      ),
      Center(child: Text("2")), //some dummy page
      Chats(),// some other dummy page
      Profile(userInformationen: _infosTabs, updateProfile: _updateProfile), //the Profile Page plus the Error appears "Only static members can be accessed in initializers."
    ];
  
    void _updateProfil(Map&lt;String, dynamic&gt; newMap) {
      setState(() {
            _infos = newMap;
          });
    } //here i want to update the info i receive
  
    final Map&lt;String, dynamic&gt; _infos = ({
      'title': "Title",
      'name': "name",
      'points': 73,
      'about me': "texttexttexttexttext"
    });
  
  
  class Profile extends StatelessWidget {
    Profile({this.userInformationen, this.updateProfile});
  
    final Map&lt;String, dynamic&gt; userInformationen;
  
    final Function updateProfile;
  
    @override
    Widget build(BuildContext context) {
      double containerHight = 8.0;
  
      return Scaffold(
        drawer: Drawer(
          child: Scaffold(
            appBar: AppBar(
              automaticallyImplyLeading: false,
              title: Text("Info"),
            ),
            body: ListView(
              children: &lt;Widget&gt;[
                ListTile(
                  leading: Icon(Icons.settings),
                  title: Text("Profil bearbeiten"),
                  onTap: () {
                    Navigator.push(
                      context,
                      MaterialPageRoute(
                        builder: (BuildContext context) =&gt; EditProfile(
              updateProfile: updateProfile),
                  ),
                ],
              ),
            ],
          ),
        ),
      );
    }
  }
  
  
  
  class EditProfile extends StatefulWidget {
  
    final Function updateProfile;
  
    EditProfile({this.updateProfile});
  
    @override
    State&lt;StatefulWidget&gt; createState() {
      return _EditProfileStae();
    }
  }
  
  class _EditProfileState extends State&lt;EditProfile&gt; {
    _EditProfileState();
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(title: Text('Edit Profile')),
        body: Container(
          margin: EdgeInsets.all(16.0),
          child: Form(
            child: ListView(
              children: &lt;Widget&gt;[
                TextField(
                ),
                RaisedButton(
                  child: Text("Save"),
                  onPressed: () {
                    widget.updateProfile({
                      'title': 'Title',
                      'name': 'some name',
                      'points': 69,
                      'about': "texttexttext"
                    });
                    Navigator.pushReplacement(
                      context,
                      MaterialPageRoute(
                        builder: (BuildContext context) =&gt; Tabs(),
                      ),
                    );
                  },
                ),
              ],
            ),
          ),
        ),
      );
  
    }
  }
  </code></pre>
  
  <p>i dont know may be i have a complet wrong approach or its just a little mistake.</p>