Validate JSON against your own Blueprint


we use json almost every day in our job with null safety we can skip many errors but we cant test if the api still intact after each update,

and the update does’t break any thing in the data type or schema

so we meade this package mostly you can use it for testing the apis you consume with dart or what you built with dart
we could use some help if you are interested in server side dart at palace project
hope your day is bug-less with this package 💙

this package depends on dart >= 2.13.0 if you want to use it with flutter

you have to update to flutter >= 2.5

  • validate json to match any schema you want 🌟
  • support dart native types 🔍
  • support for TypeOrNull
  • support for .of for deeper and deeper validation 💪
  • throw or return false as a result 💣
  • Strong Types , also the blueprint is just a map but values must be a subtype of BluePrintField which is all of supported types null or not
  • tells you which key is a failure and why 💪
  • tested 🧪
data type non-nullable Field nullable Field
String StringF StringOrNull
int IntF IntOrNull
double DoubleF DoubleOrNull
num NumF NumOrNull
bool BoolF BoolOrNull
Map MapF MapOrNull
List ListF ListOrNull

1 – use matchMap Or matchF to get true or false as result

2 – set the throwable parameter to true to throw the error in case of miss match

3 – use .of() function on Map and List it is available on there four rules MapF,MapOrNull,ListF , ListOrNull to validate deer inside the object

4 – in case of null value the nullable Field Rule will not validate against the args an consider it a match

5 – in case of a value in the nullable Field Rule the .of() function will validate against the args and return the result based on that

example 1

import 'package:blueprint/blueprint.dart';

void main(List<String> arguments) {
  //* use try/catch blocs to catch the failure message
  try {
    // simple one felid
      // the json
      {'name': 'queen'},
      // the blue print
      {'name': String},
      // * you can use supported Felids only , they are listen in the file

    print('[👑][blue_print] match result is ✅');
  } catch (e) {
    print('[👑][blue_print] match result is ❌');

View Github

Semiconductors PLI Scheme Worth Rs 76000 Crore a Turning Point for India

UP Health Worker Recruitment 2021, Apply Online For 9212 स्वास्थ्य कार्यकर्ता