OverviewHistoryStatsSecurity
npx skills add ...
Documentation
SKILL.md
npx skills add flutter/skills --skill flutter-implement-json-serialization
Create model classes with `fromJson` and `toJson` methods using `dart:convert`. Use when manually mapping JSON keys to class properties for simple data structures.
This repo is now called flutter/agent-plugins. Both names install the same content, but the install count here only covers this one.
npx skills add flutter/skills --skill flutter-implement-json-serialization
dart:convert: Utilize Flutter's built-in dart:convert library for manual JSON encoding (jsonEncode) and decoding (jsonDecode).dynamic result of jsonDecode() to the expected type, typically Map<String, dynamic> for objects or List<dynamic> for arrays.fromJson factory constructor and a toJson method within the model.compute() function to prevent UI jank.null.Use this checklist to implement manual JSON serialization for a data model.
Task Progress:
final properties.factory Model.fromJson(Map<String, dynamic> json) constructor.Map<String, dynamic> toJson() method.fromJson: Extract values from the Map and cast them to the appropriate Dart types. Use pattern matching or explicit casting.toJson: Return a Map<String, dynamic> mapping the class properties back to their JSON string keys.Use this conditional workflow when retrieving and parsing JSON from a network request.
Task Progress:
http package to perform the network call.response.statusCode == 200 (or 201 for POST), proceed to parsing.Exception.compute(parseFunction, response.body) to parse in a background isolate.fromJson constructor.