applyOptional function

Object? applyOptional(
  1. Parser parser,
  2. Object data,
  3. bool debug
)

Implementation

Object? applyOptional(Parser parser, Object data, bool debug) {
  try {
    if (parser.optional!.apply != null) {
      switch (parser.optional!.apply) {
        case ApplyMethod.urldecode:
          return Uri.decodeFull(data.toString());
        case ApplyMethod.mapToList:
          if (data is Map) {
            return data.values.toList();
          }
        default:
      }
    }
  } catch (e) {
    printLog(
      "Error in function applyOptional: $e",
      debug,
      color: LogColor.red,
    );
  }
  return null;
}