generateString method

String generateString({
  1. bool withDart = false,
  2. bool withFunctionDart = false,
  3. bool withFunctionC = false,
  4. bool withName = false,
  5. bool withCaller = false,
})

Generates necessary code for a SteamParam as String

Implementation

String generateString({
  bool withDart = false,
  bool withFunctionDart = false,
  bool withFunctionC = false,
  bool withName = false,
  bool withCaller = false,
}) {
  Token token = type.toToken();
  StringBuffer sb = StringBuffer();
  if (withDart) {
    sb.write(token.typeDart);
  }

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

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

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

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

  sb.write(",");

  return sb.toString();
}