fileNameToShaderId function Null safety

String fileNameToShaderId(
  1. String fileName
)

Convertes a filename to a shader id

  • fileName: The name of the file

Returns a shader id from a filename through the conversion of each ascii code to the respectve letter. Each ascii code is extracted from a 3 digit number so the number or digits in filename should be actually a multiple of 3

Implementation

String fileNameToShaderId(String fileName) {
  return String.fromCharCodes(
      codePairsRegExp.allMatches(fileName).map((m) => int.parse(m.group(0)!)));
}