dart-sdk/samples/ffi/sqlite
Samir Jindel 4ee5ef9f10 [vm/ffi] Use Pointer<Null> as the type of nullptr.
Also clean up test/benchmark/sample code using nullptr and fix pubspec.yaml in the SQLite sample.

Fixes https://github.com/dart-lang/sdk/issues/37362

Change-Id: I6fa0522374af28020ef8f096ac22b23712aedb5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/121122
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2019-10-11 14:39:47 +00:00
..
docs [vm/ffi] Use Pointer<Null> as the type of nullptr. 2019-10-11 14:39:47 +00:00
example [vm/ffi] Deprecate Pointer.allocate/free. 2019-10-10 13:17:43 +00:00
lib [vm/ffi] Use Pointer<Null> as the type of nullptr. 2019-10-11 14:39:47 +00:00
test [vm/ffi] Deprecate Pointer.allocate/free. 2019-10-10 13:17:43 +00:00
.gitignore [doc] dart:ffi SQLite sample 2019-03-26 14:46:09 +00:00
pubspec.yaml [vm/ffi] Use Pointer<Null> as the type of nullptr. 2019-10-11 14:39:47 +00:00
README.md [vm/ffi] Add copyright headers to sqlite example and incorporate Michael's feedback. 2019-03-27 14:11:17 +00:00

Sample code dart:ffi

This is an illustrative sample for how to use dart:ffi.

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).