processWidgetParams method

RawWidgetDj processWidgetParams(
  1. String name,
  2. List<String> lines,
  3. String filePath, {
  4. int debugLvl = 0,
  5. bool initialIsOptional = false,
})

Implementation

RawWidgetDj processWidgetParams(
  String name,
  List<String> lines,
  String filePath, {
  int debugLvl = 0,
  bool initialIsOptional = false,
}) {
  var parameterLines = <String>[];

  var gotAllParameters = false;
  lines.forEach((line) {
    if (!line.contains('$name(') &&
        !gotAllParameters &&
        line.isNotEmpty &&
        !CommentLineChecker(line: line).check()) {
      if ((line.contains(')') && line.contains(':')) ||
          line.contains(');') ||
          (line.contains(':') && line.contains('assert'))) {
        gotAllParameters = true;
      }
      if (!gotAllParameters) {
        parameterLines.add(line);
      }
    }
  });

  var parameters = processParameterLines(
    parameterLines,
    intialIsOptional: initialIsOptional,
  );

  var rawWidgetDj = RawWidgetDj(
    parameters: parameters,
    name: name,
    originFilePath: filePath,
  );

  return rawWidgetDj;
}