shaderIdToFileName function Null safety

String shaderIdToFileName(
  1. String shaderId
)

Converts a shaderId to a filename suitable for case sensitive OS's

  • shaderId: The id of the shader

Returns a filename through the conversion of a shaderId letter by letter to the equivalent String but where each letter is represented ascii code padded til 3 with '0's

Implementation

String shaderIdToFileName(String shaderId) {
  return shaderId.runes.fold(
      '',
      (previousValue, element) =>
          previousValue + element.toString().padLeft(3, '0'));
}