sdlxSaveFile function iostream
Save all the data into a file path.
\param file the path to write all available data into. \param data the data to be written. If datasize is 0, may be NULL or a invalid pointer. \param datasize the number of bytes to be written. \returns true on success or false on failure; call SDL_GetError() for more information.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL 3.2.0.
\sa SDL_SaveFile_IO \sa SDL_LoadFile
extern SDL_DECLSPEC bool SDLCALL SDL_SaveFile(const char *file, const void *data, size_t datasize)
Implementation
bool sdlxSaveFile(String file, Uint8List data, {bool closeio = false}) {
final dataPointer = ffi.calloc<Uint8>(data.length);
dataPointer.asTypedList(data.length).setAll(0, data);
final result = sdlSaveFile(file, dataPointer.cast<Void>(), data.length);
dataPointer.callocFree();
return result;
}