cv_json library
ContentValue Json helpers.
Classes
-
CvColumn<
T extends Object?> - Content value column.
-
CvField<
T extends Object?> - Basic CvField
- CvFillOptions
- Fill options for unit tests
-
CvListField<
T extends Object?> - Nested list of raw values
- CvMapModel
- Modifiable map.
- CvModel
- Model to access the data (implies CvModelRead and CvModelCore)
- CvModelBase
- Base content class
- CvModelEmpty
- Empty model.
-
CvModelField<
T extends CvModel> - Nested model
-
CvModelListField<
T extends CvModel> - Nested list, where each value is of type T
-
CvModelMapField<
T extends CvModel> - Nested map where each value is of type T, (key is a string)
- CvTreePath
- Tree path
Extensions
- CvFieldListExt on CvFields
- Utilities
-
CvFieldUtilsExt
on CvField<
T> - Field utils.
- CvJsonListExt on List
- Easy Map extension
- CvJsonMapExt on Map
- Easy Map extension
- CvJsonModelExt on CvModel
- Easy CvModel extension
-
CvJsonModelListExt
on List<
T> - Easy CvModelList extension
- CvJsonStringExt on String
- Easy string extension, assume a json encoded
-
CvListFieldUtilsExt
on CvListField<
T> - Fill helpers
- CvMapExt on Map
- Easy extension
-
CvMapListExt
on List<
Map> - Easy extension
- CvModelCloneExt on T
- Public extension on CvModelWrite
-
CvModelFieldUtilsExt
on CvModelField<
T> - Field extension utilities
-
CvModelMapFieldUtilsExt
on CvModelMapField<
T> - Fill helpers
- CvModelReadExt on CvModelRead
- Public extension on CvModelCore
-
CvModelReadListExt
on List<
T> -
List<CvModel>
convenient extensions. - CvModelUtilsExt on CvModel
- Test fill model utilities.
- CvModelWriteExt on CvModelWrite
- Public extension on CvModelWrite
-
CvTreePathFieldExt
on CvField<
Object?> - Public extension on CvModelRead
-
CvTreePathListFieldExt
on CvListField<
Object?> - Public extension on CvModelRead
-
CvTreePathModelFieldExt
on CvModelField<
T> - Public extension on CvModelField
-
CvTreePathModelListFieldExt
on CvModelListField<
T> - Public extension on CvListField
-
CvTreePathModelMapField
on CvModelMapField<
T> - Public extension on CvModelMapField
- CvTreePathModelReadExt on T
- Public extension on CvModelRead
- ModelListExt on ModelList
- Convenient extension on Model
- ModelRawListExt on List
- Convenient extension on Model
- ModelRawMapExt on Map
- Convenient extension on Model
- ModelRawObjectExt on Object
- Global extension on any object.
Properties
- cvFillOptions1 → CvFillOptions
-
Common fill options for unit tests.
no setter
Functions
-
asModel(
Map map) → Model - Cast the map if needed.
-
asModelList(
Iterable list) → ModelList - Cast the list if needed.
-
cvAddBuilder<
T extends CvModel> (CvModelBuilderFunction< T> builder) → void - Add builder that uses builder function
-
cvAddConstructor<
T extends CvModel> (CvModelDefaultBuilderFunction< T> builder) → void - Add convenient constructor tear-off
-
cvAddConstructors<
T extends CvModel> (List< CvModelDefaultBuilderFunction< builders) → voidT> > - Add convenient constructors tear-off
-
cvAnyToJsonArrayOrNull(
Object? source) → List< Object?> ? - Decode any object list
-
cvAnyToJsonObjectOrNull(
Object? source) → Model? - Decode any object
-
cvBuildModel<
T extends CvModel> (Map contextData, {CvModelBuilderFunction< T> ? builder}) → T - Build a model but does not import the data.
-
cvGetBuilder<
T extends CvModel> ({CvModelBuilderFunction< T> ? builder}) → CvModelBuilderFunction<T> - Get a builder.
-
cvModelField<
T extends CvModel> (String name) → CvModelField< T> - Auto field
-
cvModelListField<
T extends CvModel> (String name) → CvModelListField< T> - Auto field
-
cvModelsAreEquals(
CvModelRead model1, CvModelRead model2, {List< String> ? columns}) → bool - If 2 models are equals
-
cvNewModel<
T extends CvModel> () → T - New model from an empty map.
-
cvNewModelList<
T extends CvModel> ({bool lazy = true}) → List< T> - New empty cv model list.
-
cvTypeAddBuilder(
Type type, CvModelBuilderFunction< Object> builder) → void - Add builder that uses builder function
-
cvTypeBuildModel<
T extends CvModel> (Type type, Map contextData, {T builder(Map contextData)?}) → T - Build a model but does not import the data.
-
cvTypeGetBuilder<
T extends CvModel> (Type type, {CvModelBuilderFunction< T> ? builder}) → CvModelBuilderFunction<T> - Get a builder from a type.
-
cvTypeNewModel<
T extends CvModel> (Type type) → T - New model from an empty map.
-
cvTypeNewModelList<
T extends CvModel> (Type type, {bool lazy = true}) → List< T> - New empty cv model list.
-
cvValuesAreEqual(
dynamic v1, dynamic v2) → bool - If 2 values are equals, entering nested list/map if any.
-
jsonPrettyEncode(
Object? object) → String - Encode object to json with 2 spaces indent.
-
keyPartsFromString(
String key) → List< Object> -
Convert 'key1.key2.index3.key4' to
'key1', 'key2', index3, 'key4
-
keyPartsToString(
List< Object> parts) → String -
Convert
'key1', 'key2', index3, 'key4
to 'key1.key2.index3.key4' string representing are double quoted (i.e. "1") part with a dot are not supported yet... -
NewModel(
) → Model - Create a new model - prefer newModel()
-
newModel(
) → Model - Create a new model
-
newModelList(
) → ModelList - Create a new model list
Typedefs
-
CvBuilderFunction<
T> = T Function(Map contextData) - Builder function definition
-
CvFields
= List<
CvField< Object?> > - Generic fields type helper for model fields value.
-
CvModelBuilderFunction<
T extends Object> = T Function(Map contextData) - A model builder function should only build the model but should not fill it with the data.
-
CvModelDefaultBuilderFunction<
T extends Object> = T Function() - A model default builder takes no arguments and only create the object without context.
-
Model
= Map<
K, V?> - Model type
-
ModelEntry
= MapEntry<
K, V?> - Model entry
-
ModelList
= List<
Model> - Model list type
Exceptions / Errors
- CvBuilderException
- CvBuilder exception.