tryParse method

dynamic tryParse(
  1. String? input
)

Parses the given string as either JSON or YAML. If null is passed in, null will be returned. If the passed in string can neither be decoded via JSON nor YAML an event will be logged and null will be returned.

Implementation

dynamic tryParse(String? input) {
  dynamic result;
  try {
    result = parse(input);
  } catch (e, stack) {
    _logger.severe(
      'Error processing: $input',
      e,
      stack,
    );
  }

  return result;
}