ffi 0.1.3 copy "ffi: ^0.1.3" to clipboard
ffi: ^0.1.3 copied to clipboard

outdated

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

example/main.dart

import 'dart:ffi';

import 'package:ffi/ffi.dart';

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

  // Use the Utf8 helper to encode null-terminated Utf8 strings in native memory.
  final String myString = "πŸ˜ŽπŸ‘ΏπŸ’¬";
  final Pointer<Utf8> charPointer = Utf8.toUtf8(myString);
  print("First byte is: ${charPointer.cast<Uint8>().value}");
  print(Utf8.fromUtf8(charPointer));
  free(charPointer);
}
246
likes
40
pub points
99%
popularity

Publisher

verified publisherdart.dev

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

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

More

Packages that depend on ffi