fromDucFormatExtern function

String? fromDucFormatExtern(
  1. String duc,
  2. [void onBad(
      )?]
    )

    Implementation

    String? fromDucFormatExtern(String duc, [void Function()? onBad]) {
      try {
        int version = int.parse(duc.substring(0, 1));
        if (version != EPHEMERAL_MODELS_VERSION) {
          Debug().info(
              "Encountered a version mismatch in DUC (Received:$version =/= Local:$EPHEMERAL_MODELS_VERSION) . Failing parse.");
          if (onBad != null) {
            onBad.call();
          }
          return null;
        }
        duc = duc.substring(1);
        String data = utf8.decode(gzip.decode(base64.decode(duc)));
        if (data.substring(0, _keyword.length) != _keyword) {
          return null; // L bozo issue
        } else {
          return data.substring(_keyword.length);
        }
      } on Exception catch (_) {
        return null;
      }
    }