Last updated:
0 purchases
flutter gb built utils
Flutter GB Built Utils #
Flutter GB Built Utils is a collection of built_value serializer plugins to make it easier to handle different data types and serialization/deserialization in your Flutter project.
Plugins #
The package includes the following plugins:
BuiltBoolNumParsePlugin
BuiltEntityIdRetroCompatibilityPlugin
BuiltForceNumberParsePlugin
BuiltNumToStringPlugin
DateTimeSerializerPlugin
BuiltBoolNumParsePlugin #
This plugin helps to parse num to boolean.
Example Usage:
final serializers = (Serializers().toBuilder()
..addPlugin(BuiltBoolNumParsePlugin()))
.build();
copied to clipboard
BuiltEntityIdRetroCompatibilityPlugin #
This plugin is to help prevent unwanted crashes because the backend changed entity.id to entity._id.
Example Usage:
final serializers = (Serializers().toBuilder()
..addPlugin(BuiltEntityIdRetroCompatibilityPlugin()))
.build();
copied to clipboard
BuiltForceNumberParsePlugin #
This plugin helps to parse string, int, or double to its target type (int, double, number).
Example Usage:
final serializers = (Serializers().toBuilder()
..addPlugin(BuiltForceNumberParsePlugin()))
.build();
copied to clipboard
BuiltNumToStringPlugin #
This plugin helps to parse num, int, or double to a string.
Example Usage:
final serializers = (Serializers().toBuilder()
..addPlugin(BuiltNumToStringPlugin()))
.build();
copied to clipboard
DateTimeSerializerPlugin #
This plugin helps to serialize and deserialize DateTime objects.
Example Usage:
final serializers = (Serializers().toBuilder()
..addPlugin(DateTimeSerializerPlugin(
applyEncode: true,
applyDecode: true,
nullOnInvalid: true)))
.build();
copied to clipboard
Installation #
Add the following to your pubspec.yaml file:
dependencies:
flutter_gb_built_utils: ^1.0.0
copied to clipboard
Then, run flutter pub get.
Usage #
Import the package in your Dart code:
import 'package:flutter_gb_built_utils/flutter_gb_built_utils.dart';
copied to clipboard
Add the required plugins to your built_value serializers:
final serializers=(Serializers().toBuilder()
..addPlugin(BuiltBoolNumParsePlugin())
..addPlugin(BuiltEntityIdRetroCompatibilityPlugin())
..addPlugin(BuiltForceNumberParsePlugin())
..addPlugin(BuiltNumToStringPlugin())
..addPlugin(DateTimeSerializerPlugin(
applyEncode:true,
applyDecode:true,
nullOnInvalid:true
))).build();
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.