flutter_class_parser
0.2.6, released 5 weeks ago by wenkaifan.com
Serialize and deserialize common Flutter UI data classes and widgets.
What it does
Provides extension methods and functions to serialize and deserialize common Flutter UI data classes like colors, gradients, geometry, and text styles. Serialization is handled through extension methods while deserialization uses parsing functions.
AI-written summary of version 0.2.6, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to serialize common Flutter UI classes like Color, EdgeInsets, or TextStyle to JSON
- You need to deserialize UI data from JSON without writing custom parser functions
Skip it when
- You need automatic code generation for complex custom data models
- You need features outside of the predefined list of supported Flutter classes
Strengths
- Supports a wide range of common UI classes out of the box
- Simple API using extension methods and standalone parsing functions
- Works with both material and standalone widgets libraries
Weaknesses
- Some class parsing is limited or not fully supported yet
- Relies on manual parsing functions instead of build-time code generation
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
var gradient = LinearGradient(colors: [Colors.red, Colors.blue]);
String gradientJson = json.encode(gradient.toJson());
var gradient2 = parseGradient(json.decode(gradientJson));Alternatives
Packages that do the same job and could replace flutter_class_parser.
- basic_utils
Common utility classes for Strings, Dates, X509, PKCS, Cryptography and HTTP requests.
57Compare - collection
Utility functions and classes that extend Dart's collection types and algorithms.
50Compare - typed_data
Utility functions and classes for easier work with dart:typed_data lists.
50Compare - buffer
Utilities and classes for reading and writing byte buffers and binary data streams.
50Compare
Works with
Packages commonly used together with flutter_class_parser: ones it builds on, ones built on it, and its own family.
- dimensionBuilt on flutter_class_parserMimics CSS length units (px, percentage, vw, vh, vmin, vmax) for responsive Flutter layouts.
- morphable_shapeBuilt on flutter_class_parserCreate responsive shapes and morph between them in Flutter.
- animated_styled_widgetBuilt on flutter_class_parserSerializable CSS-inspired styles with implicit and explicit animations for custom widgets.
- responsive_propertyBuilt on flutter_class_parserResponsive values and widgets based on screen size using ScreenScope and Responsive classes