Skip to content
pubscout

flutter_class_parser

0.2.6, released 5 weeks ago by wenkaifan.com

Serialize and deserialize common Flutter UI data classes and widgets.

WASM-ready
$ flutter pub add flutter_class_parser
Source repository

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.

  • collection

    Utility functions and classes that extend Dart's collection types and algorithms.

  • typed_data

    Utility functions and classes for easier work with dart:typed_data lists.

  • buffer

    Utilities and classes for reading and writing byte buffers and binary data streams.

Works with

Packages commonly used together with flutter_class_parser: ones it builds on, ones built on it, and its own family.