json_annotation_fs 0.1.0+1
json_annotation_fs: ^0.1.0+1 copied to clipboard
Safe JSON annotation package with error handling for Flutter/Dart. Extends json_annotation with robust parsing that prevents crashes on malformed or incomplete JSON data.
example/lib/main.dart
import 'person_model.dart';
void main() {
final person1 = PersonFS.fromJson(personJson as Map<String, dynamic>);
print("Name: ${person1.name} is ${person1.name.runtimeType}");
print("Age: ${person1.age} is ${person1.age.runtimeType}");
print(
"Marital Status: ${person1.maritalStatus} is ${person1.maritalStatus.runtimeType}");
print(
"Birth Date Time: ${person1.birthDateTime} is ${person1.birthDateTime.runtimeType}");
print(
"Number of Children: ${person1.numberOfChildren} is ${person1.numberOfChildren.runtimeType}");
print(
'Employment Status: ${person1.employmentStatus} is ${person1.employmentStatus.runtimeType}');
print(
'Missing Nullable: ${person1.missingNullable} is ${person1.missingNullable.runtimeType}');
print(
'Missing Nullable Has Value: ${person1.nullableHasValue} is ${person1.nullableHasValue.runtimeType}');
print(
'Missing Non Nullable Field: ${person1.missingNonNullable} is ${person1.missingNonNullable.runtimeType}');
}