File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3- ## 0.1.4
3+ ## 0.1.3-dev. 4
44
55Bump SDK constraint to ` >= 2.6.0-dev.8.2 ` which contains the new API of ` dart:ffi ` .
66
Original file line number Diff line number Diff line change 1+ import 'dart:ffi' ;
2+
3+ import 'package:ffi/ffi.dart' ;
4+
5+ main () {
6+ // Allocate and free some native memory with malloc and free.
7+ final pointer = allocate <Uint8 >();
8+ pointer.value = 3 ;
9+ print (pointer.value);
10+ free (pointer);
11+
12+ // Use the Utf8 helper to encode null-terminated Utf8 strings in native memory.
13+ final String myString = "😎👿💬" ;
14+ final Pointer <Utf8 > charPointer = Utf8 .toUtf8 (myString);
15+ print ("First byte is: ${charPointer .cast <Uint8 >().value }" );
16+ print (Utf8 .fromUtf8 (charPointer));
17+ free (charPointer);
18+ }
Original file line number Diff line number Diff line change 11name : ffi
2- version : 0.1.4
2+ version : 0.1.3-dev. 4
33author :
Dart Team <[email protected] > 44homepage : https://github.com/dart-lang/ffi
55description : Utilities for working with Foreign Function Interface (FFI) code.
66
77environment :
88 sdk : ' >=2.6.0-dev.8.2 <3.0.0'
9- documentation : https://pub.dev/documentation/ffi/
109
1110dependencies :
1211
You can’t perform that action at this time.
0 commit comments