ffi 0.3.1-nullsafety.0 copy "ffi: ^0.3.1-nullsafety.0" to clipboard
ffi: ^0.3.1-nullsafety.0 copied to clipboard

outdated

Utilities for working with Foreign Function Interface (FFI) code.

example/main.dart

import 'dart:ffi';

import 'package:ffi/ffi.dart';

void main() {
  // Allocate and free some native memory with calloc and free.
  final pointer = calloc<Uint8>();
  pointer.value = 3;
  print(pointer.value);
  calloc.free(pointer);

  // Use the Utf8 helper to encode zero-terminated UTF-8 strings in native memory.
  final String myString = 'πŸ˜ŽπŸ‘ΏπŸ’¬';
  final Pointer<Utf8> charPointer = myString.toNativeUtf8();
  print('First byte is: ${charPointer.cast<Uint8>().value}');
  print(charPointer.toDartString());
  calloc.free(charPointer);
}
244
likes
0
pub points
99%
popularity

Publisher

verified publisherdart.dev

Utilities for working with Foreign Function Interface (FFI) code.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on ffi