initLibrary function

void initLibrary({
  1. String? linux,
  2. String? windows,
})

Initialize the raylib library by passing the path to the library for each supported platform.

Implementation

void initLibrary({
  String? linux,
  String? windows,
}) {
  if (Platform.isLinux && linux == null) {
    throw Exception('Running on linux but no library path was provided');
  } else if (Platform.isWindows && windows == null) {
    throw Exception('Running on windows but no library path was provided');
  }

  final String libraryPath;
  if (Platform.isLinux) {
    libraryPath = linux!;
  } else if (Platform.isWindows) {
    libraryPath = windows!;
  } else {
    throw UnsupportedError(
      '''
Platform ${Platform.operatingSystem} is untested and therefore unsupported.
Please file a bug report if you think this is incorrect
''',
    );
  }

  library = Raylib(DynamicLibrary.open(libraryPath));
}