flutter_class_parser

A package for serialize and deserialize common UI data classes in Flutter.

Getting Started

To serialize/deserialize a supported class, use:

var gradient=LinearGradient(colors:[Colors.red, Colors.blue]);
String gradientJson=json.encode(gradient.toJson());
var gradient2=parseGradient(json.decode(gradientJson));

Serializaton of built in classes is done using extension methods. Deserializaion, on the other hand, is done with funtions.

Current Supported Classes

  1. Color
  2. Orientation
  3. BlendMode
  4. TileMode
  5. Alignment
  6. BoxFit
  7. ImageRepeat
  8. FilterQuality
  9. StackFit
  10. FontWeight
  11. FontStyle
  12. Axis
  13. AxisDirection
  14. TextDecoration
  15. TextDecorationStyle
  16. Clip
  17. Curve
  18. TextOverflow
  19. TextDirection
  20. TextAlign
  21. TextBaseline
  22. FontWeight
  23. MainAxisAlignment
  24. CrossAxisAlignment
  25. WrapAlignment
  26. WrapCrossAlignment
  27. MainAxisSize
  28. VerticalDirection
  29. BorderStyle
  30. StrokeJoin
  31. StrokeCap
  32. Offset
  33. Size
  34. Rect
  35. EdgeInsets
  36. Radius
  37. BorderRadius
  38. Matrix4
  39. SystemMouseCursor
  40. Gradient
  41. Shadow
  42. ImageFilter
  43. ColorFilter
  44. DecorationImage
  45. BoxDecoration
  46. TextStyle

Some class parsing are not fully supported yet. For example, the Curve class parsing only supports the predefined curves.

You are more than welcomed to contribute and add more classes to the collection.