initInspectorServerNativeBinding function
void
initInspectorServerNativeBinding(
- int contextId
)
Implementation
void initInspectorServerNativeBinding(int contextId) {
DynamicLibrary? nativeDynamicLibrary = getDynamicLibrary();
if (nativeDynamicLibrary == null) return;
final DartRegisterDartMethods _registerInspectorServerDartMethods =
nativeDynamicLibrary
.lookup<NativeFunction<NativeRegisterDartMethods>>(
'registerInspectorDartMethods')
.asFunction();
final Pointer<NativeFunction<NativeInspectorMessage>>
_nativeInspectorMessage = Pointer.fromFunction(_onInspectorMessage);
final Pointer<NativeFunction<NativeRegisterInspectorMessageCallback>>
_nativeRegisterInspectorMessageCallback = Pointer.fromFunction(_registerInspectorMessageCallback);
final Pointer<NativeFunction<NativePostTaskToUIThread>> _nativePostTaskToUIThread = Pointer.fromFunction(_postTaskToUIThread);
final List<int> _dartNativeMethods = [
_nativeInspectorMessage.address,
_nativeRegisterInspectorMessageCallback.address,
_nativePostTaskToUIThread.address
];
Pointer<Uint64> bytes = malloc.allocate<Uint64>(_dartNativeMethods.length * sizeOf<Uint64>());
Uint64List nativeMethodList = bytes.asTypedList(_dartNativeMethods.length);
nativeMethodList.setAll(0, _dartNativeMethods);
_registerInspectorServerDartMethods(bytes, _dartNativeMethods.length);
}