decodeJson method

String decodeJson(
  1. String url
)

A deep-link preview as a JSON string ({ok, lines}) — the body of the ext.kaisel.decode service extension. Decodes url through the first registered root's codec, without navigating.

Implementation

String decodeJson(String url) {
  final root = _roots.values.isEmpty ? null : _roots.values.first;
  final lines = root?.debugDecode(url);
  return jsonEncode(<String, Object?>{
    'ok': lines != null,
    'lines': lines ?? <String>[],
  });
}