mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:49:00 +00:00
550d580d5e
This does not include enabling the FFI on Fuchsia. So these tests will fail without the dependent CL. This CL adds an `all_positive.dart` test file to be packaged in the .far file, such that it is easier to run all FFI tests in one go. We don't run tests on the bots, but we do build this test package on the bots. To build the .far files locally: ``` tools/build.py --os=fuchsia -m debug fuchsia_ffi_test_package tools/build.py --os=fuchsia -m debug -a arm64 fuchsia_ffi_test_package ``` Issue: https://github.com/dart-lang/sdk/issues/44434 Change-Id: Iec418e0c10d77afbf811fb83151664bcc2710b99 Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175484 Reviewed-by: Liam Appelbe <liama@google.com> |
||
---|---|---|
.. | ||
docs | ||
example | ||
lib | ||
test | ||
.gitignore | ||
pubspec.yaml | ||
README.md |
Sample code dart:ffi
This is an illustrative sample for how to use dart:ffi
.
Prerequirement
For Windows, Linux, and MacOS, you should make sure, sqlite dev lib installed on your system.
Windows user can download dll from https://www.sqlite.org/download.html
If you do not have any sqlite3.dll or so file, you may found error message:
Unhandled exception:
Invalid argument(s): Failed to load dynamic library (126)
#0 _open (dart:ffi-patch/ffi_dynamic_library_patch.dart:13:55)
#1 new DynamicLibrary.open (dart:ffi-patch/ffi_dynamic_library_patch.dart:22:12)
Building and Running this Sample
Building and running this sample is done through pub.
Running pub get
and pub run example/main
should produce the following output.
$ pub get
Resolving dependencies... (6.8s)
+ analyzer 0.35.4
...
+ yaml 2.1.15
Downloading analyzer 0.35.4...
Downloading kernel 0.3.14...
Downloading front_end 0.1.14...
Changed 47 dependencies!
Precompiling executables... (18.0s)
Precompiled test:test.
$ pub run example/main
1 Chocolade chip cookie Chocolade cookie foo
2 Ginger cookie null 42
3 Cinnamon roll null null
1 Chocolade chip cookie Chocolade cookie foo
2 Ginger cookie null 42
expected exception on accessing result data after close: The result has already been closed.
expected this query to fail: no such column: non_existing_column (Code 1: SQL logic error)
Tutorial
A tutorial walking through the code is available in docs/sqlite-tutorial.md. For information on how to use this package within a Flutter app, see docs/android.md. (Note: iOS is not yet supported).