resolveIncludes method

String resolveIncludes(
  1. String string
)

Implementation

String resolveIncludes(String string) {
  // return string.replaceAll(includePattern, includeReplacer);

  // Loop through all matches.
  for (var match in includePattern.allMatches(string)) {
    /// Returns the string matched by the given [group].
    ///
    /// If [group] is 0, returns the match of the pattern.
    ///
    /// The result may be `null` if the pattern didn't assign a value to it
    /// as part of this match.
    // print(" resolveIncludes ");
    // print(match.group(0)); // 15, then 20

    String includeString = match.group(1)!;

    // print(" includeString: ${includeString} ");

    String targetString = shaderChunk[includeString]!;

    String targetString2 = resolveIncludes(targetString);

    String fromString = match.group(0)!;

    string = string.replaceFirst(fromString, targetString2);
  }

  return string;
}