safe_json 1.0.7 copy "safe_json: ^1.0.7" to clipboard
safe_json: ^1.0.7 copied to clipboard

Primary purpose of this library is to find out backend error(incomplete data) at the first time.

safe_json #

License

Small, easy to use null safety json decoding library. The primary goal of this library is to find out bugs in the early stages of development when parsing JSON values.

Features #

  • Safely parse JSON values to various data types.
  • Provide default values when parsing fails.
  • Error logging with file location.

Examples #

final name = json.safeString('name', defaultValue: 'John');

final age = json.safeInt('age');

final articles = json.safeList<String>('articles');

final vehicles = json.safeList<Vehicle>('vehicles', itemParse: (json) => Vehicle.fromJson(json));

//set to true if want to disable error logging (usually in production)
SafeJsonLibrary.skipLog = true; 

//set the stacktrace count showing in console
SafeJsonLibrary.stackTraceCount = 1; 

Console Logs #

Installation #

Add safe_json to your pubspec.yaml file:

dependencies:
  safe_json: ^1.0.7
1
likes
0
points
76
downloads

Publisher

unverified uploader

Weekly Downloads

Primary purpose of this library is to find out backend error(incomplete data) at the first time.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on safe_json