Sprawdź, czy ciąg jest prawidłowy JSON DART

void main() {
  var jsonString = '{"abc';
  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');
  }
  print('Decoding succeeded: $decodeSucceeded');
}
Zealous Zebra