title: How to make a data model change in a Flutter app in production?
body: <p>I am developing my first mobile app with Flutter and I have a doubt.</p>
  <p>Suppose the app receives a JSON like this:</p>
  <pre><code>{
    &quot;_id&quot;: &quot;123&quot;,
    &quot;name&quot;: &quot;X&quot;,
  }
  </code></pre>
  <p>To receive it and send it the following model would be created:</p>
  <pre><code>class User {
     String id;
     String name;
  
     User({
        this.id,
        this.name
     });
  
     factory User.fromJson(Map&lt;String, dynamic&gt; json) =&gt; User(
        id: json[&quot;_id&quot;],
        name: json[&quot;name&quot;]
     );
  
     Map&lt;String, dynamic&gt; toJson() =&gt; {
        &quot;_id&quot;: id,
        &quot;name&quot;: name
     };
  }
  </code></pre>
  <p>Now for some reason I need to change the model structure of that data to, for example:</p>
  <pre><code>{
     &quot;id&quot;: &quot;123&quot;,
     &quot;info&quot;: {
        &quot;name&quot;:&quot;X&quot;,
        &quot;age&quot;:&quot;20&quot;
     }
  }
  </code></pre>
  <p>In the database there are objects stored with the old structure and, when the app receives them, there will be an error because the new model does not match the old data.</p>
  <p>If the app is already in production, what is the most common way to avoid this error without affecting the users?</p>