Creating Immutable Functional Style Dart Model Objects based on JSON or JSON schemas
Flutter is opinionated about using a functional programming model that includes immutable data objects. I've found that we tend to ignore that whole immutable thing when dealing with JSON data. Projects can be loose when handling incoming JSON data and how it is accessed, sprinkling string-style map keys across the codebase. We can reduce that tendency by providing models to eliminate the string keys and mutable models to stop people from directly manipulating maps of strings. Some languages are functional only. Other languages have no way of generating immutable objects. In those cases, we just end up with objects that can be easily converted into and out of JSON structures and strings. I'm working in Dart right now so the rest of this will be Dart samples Modeling Longitude and Latitude Using the JSON Schema Let's pick something simple as an example. We're going to use this Latitude and Longitude JSON Schema that follows the schema defin...