register static method
Registers the Apple MLX runtime with the shared backend registry.
Returns false off iOS, in the iOS Simulator, or when the native runtime
was not linked into the application. Calling this method more than once
is safe.
Implementation
static Future<bool> register({int priority = 100}) async {
if (isRegistered) {
_logger.debug('MLX already registered');
return true;
}
if (!isAvailable) {
_logger.warning('MLX runtime is unavailable on this target');
return false;
}
try {
final bindings = _bindings ??= MLXBindings();
final result = bindings.register(priority);
if (result != RacResultCode.success &&
result != RacResultCode.errorModuleAlreadyRegistered) {
_logger.warning('MLX backend registration returned: $result');
return false;
}
_isRegistered = true;
_logger.info('MLX backend registered');
return true;
} catch (error) {
_logger.warning('MLX registration failed: $error');
return false;
}
}