generate method

void generate({
  1. required IOSink fileSink,
  2. bool withDart = false,
  3. bool withFunctionDart = false,
  4. bool withFunctionC = false,
  5. bool withName = false,
  6. bool withCaller = false,
})

Generates necessary code for a SteamParam

Implementation

void generate({
  required IOSink fileSink,
  bool withDart = false,
  bool withFunctionDart = false,
  bool withFunctionC = false,
  bool withName = false,
  bool withCaller = false,
}) {
  Token token = type.toToken();

  if (withDart) {
    fileSink.write(token.typeDart);
  }

  if (withFunctionDart) {
    fileSink.write(token.typeFfiDart);
  }

  if (withFunctionC) {
    fileSink.write(token.typeFfiC);
  }

  if (withName) {
    fileSink.write(" ${name.clearSteamNaming().camelCase}");
  }

  if (withCaller) {
    fileSink.write(
      " ${token.caller.replaceAll("{0}", name.clearSteamNaming().camelCase)}",
    );
  }

  fileSink.write(",");
}