fromNative static method

OdbcBackend fromNative(
  1. Object native
)

Builds a backend from an untyped reference. Accepts only NativeOdbcConnection or AsyncNativeOdbcConnection; throws ArgumentError otherwise. Use this on FFI / DI seams where the concrete type is only known at runtime; prefer the typed constructors elsewhere.

Implementation

static OdbcBackend fromNative(Object native) => switch (native) {
      final NativeOdbcConnection sync => SyncBackend(sync),
      final AsyncNativeOdbcConnection async => AsyncBackend(async),
      _ => throw ArgumentError.value(
          native,
          'native',
          'must be NativeOdbcConnection or AsyncNativeOdbcConnection',
        ),
    };