isJson function Null safety

bool isJson(
  1. String jsonString
)

Implementation

bool isJson(String jsonString){
  var decodeSucceeded = false;
  try {
    // var decodedJSON = json.decode(jsonString) as Map<String, dynamic>;
    decodeSucceeded = true;
  } on FormatException catch (e) {
    print('The provided string is not valid JSON\n$e');
  }
  return decodeSucceeded;
}