Loading topic
Map and List, and the basic structure of a Flutter project. You should also know that a REST API returns JSON text.2 min readMap<String, dynamic>, and the basic structure of a Flutter project. This chapter also assumes that json_annotation, json_serializable, and build_runner are already listed in pubspec.yaml.2 min readpubspec.yaml, and basic JSON maps. You should also have a Flutter project and a model annotated with @JsonSerializable.2 min readjson_serializable setup. This chapter focuses on controlling how one Dart field maps to one JSON key. The generated code still performs the conversion, but @JsonKey supplies the rules.1 min readjson_serializable workflow. You should also know that fromJson reads a Map<String, dynamic> and toJson creates one.1 min readjson_serializable converts nested JSON objects and lists into typed Dart objects.1 min readjson_serializable models. You will use generated code rather than writing fromJson and toJson by hand.1 min readjson_serializable workflow. This chapter focuses on fields whose JSON representation does not match the Dart type directly.2 min readdart:convert, and how json_serializable generates fromJson methods. This chapter focuses on failures that happen when an API returns invalid text or a valid JSON value with the wrong shape.1 min readMap<String, dynamic>, Flutter tests, and the json_serializable setup from earlier chapters. A round-trip test checks that a model can be encoded to JSON and decoded back without losing meaningful data.2 min readjson_serializable workflow. This chapter shows how to serialize a class whose field type is a type parameter, such as ApiResponse<T>.1 min readFuture, jsonDecode, and the generated fromJson methods from json_serializable. It also assumes you have a model such as User with a generated User.fromJson method.2 min readMap<String, dynamic>, and the basic role of json_serializable. This chapter compares related tools so you can choose a suitable approach instead of adding code generation automatically.2 min read