sdlNetGetError function

String? sdlNetGetError()

Get the latest error message from SDL_net.

The error message, depending on how SDL_net was built, may or may not be thread-local data. Sometimes things will set an error message when no failure was reported; the error string is only meaningful right after a public API reports a failure, and should be ignored otherwise.

\returns the last set error message in UTF-8 encoding.

\since This function is available since SDL_net 2.0.0.

extern DECLSPEC const char * SDLCALL SDLNet_GetError(void)

Implementation

String? sdlNetGetError() {
  final sdlNetGetErrorLookupFunction = libSdl2Net.lookupFunction<
      Pointer<Utf8> Function(), Pointer<Utf8> Function()>('SDLNet_GetError');
  final result = sdlNetGetErrorLookupFunction();
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}