Skip to content

Commit

Permalink
Merge branch 'main' into misc/dart-compile-page-prep
Browse files Browse the repository at this point in the history
  • Loading branch information
parlough authored Apr 18, 2022
2 parents 0c4d7b0 + ac49201 commit b21f52c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 41 deletions.
50 changes: 25 additions & 25 deletions src/_guides/libraries/c-interop.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,36 +188,36 @@ The following table lists some native types that are only
used as markers in type signatures,
and can't be instantiated in Dart code:

| **Dart type** | **Description** |
|---------------------------------------------------------------------------------------|------------------------------------------------------------------|
| [AbiSpecificInteger]({{site.dart_api}}/stable/dart-ffi/AbiSpecificInteger-class.html) | The supertype of all [Abi][] specific integer types. |
| [Bool]({{site.dart_api}}/stable/dart-ffi/Bool-class.html) | Represents a native bool in C. |
| [Double]({{site.dart_api}}/stable/dart-ffi/Double-class.html) | Represents a native 64 bit double in C. |
| [Float]({{site.dart_api}}/stable/dart-ffi/Float-class.html) | Represents a native 32 bit float in C. |
| [Int8]({{site.dart_api}}/stable/dart-ffi/Int8-class.html) | Represents a native signed 8 bit integer in C. |
| [Int16]({{site.dart_api}}/stable/dart-ffi/Int16-class.html) | Represents a native signed 16 bit integer in C. |
| [Int32]({{site.dart_api}}/stable/dart-ffi/Int32-class.html) | Represents a native signed 32 bit integer in C. |
| [Int64]({{site.dart_api}}/stable/dart-ffi/Int64-class.html) | Represents a native signed 64 bit integer in C. |
| [NativeFunction]({{site.dart_api}}/stable/dart-ffi/NativeFunction-class.html) | Represents a function type in C. |
| [Opaque]({{site.dart_api}}/stable/dart-ffi/Opaque-class.html) | The supertype of all opaque types in C. |
| [Uint8]({{site.dart_api}}/stable/dart-ffi/Uint8-class.html) | Represents a native unsigned 8 bit integer in C. |
| [Uint16]({{site.dart_api}}/stable/dart-ffi/Uint16-class.html) | Represents a native unsigned 16 bit integer in C. |
| [Uint32]({{site.dart_api}}/stable/dart-ffi/Uint32-class.html) | Represents a native unsigned 32 bit integer in C. |
| [Uint64]({{site.dart_api}}/stable/dart-ffi/Uint64-class.html) | Represents a native unsigned 64 bit integer in C. |
| [Void]({{site.dart_api}}/stable/dart-ffi/Void-class.html) | Represents a void type in C. |
| **Dart type** | **Description** |
|-------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
| [AbiSpecificInteger]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/AbiSpecificInteger-class.html) | The supertype of all [Abi][] specific integer types. |
| [Bool]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Bool-class.html) | Represents a native bool in C. |
| [Double]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Double-class.html) | Represents a native 64 bit double in C. |
| [Float]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Float-class.html) | Represents a native 32 bit float in C. |
| [Int8]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Int8-class.html) | Represents a native signed 8 bit integer in C. |
| [Int16]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Int16-class.html) | Represents a native signed 16 bit integer in C. |
| [Int32]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Int32-class.html) | Represents a native signed 32 bit integer in C. |
| [Int64]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Int64-class.html) | Represents a native signed 64 bit integer in C. |
| [NativeFunction]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/NativeFunction-class.html) | Represents a function type in C. |
| [Opaque]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Opaque-class.html) | The supertype of all opaque types in C. |
| [Uint8]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Uint8-class.html) | Represents a native unsigned 8 bit integer in C. |
| [Uint16]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Uint16-class.html) | Represents a native unsigned 16 bit integer in C. |
| [Uint32]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Uint32-class.html) | Represents a native unsigned 32 bit integer in C. |
| [Uint64]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Uint64-class.html) | Represents a native unsigned 64 bit integer in C. |
| [Void]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Void-class.html) | Represents a void type in C. |
{:.table .table-striped }

#### Instantiable native types

The following native types can be used as markers in type signatures
and they (or their subtypes) can be instantiated in Dart code:

| **Dart type** | **Description** |
|-----------------------------------------------------------------|------------------------------------------------------------------|
| [Array]({{site.dart_api}}/stable/dart-ffi/Array-class.html) | A fixed-sized array of items. Supertype of type specific arrays. |
| [Pointer]({{site.dart_api}}/stable/dart-ffi/Pointer-class.html) | Represents a pointer into native C memory. |
| [Struct]({{site.dart_api}}/stable/dart-ffi/Struct-class.html) | The supertype of all FFI struct types. |
| [Union]({{site.dart_api}}/stable/dart-ffi/Union-class.html) | The supertype of all FFI union types. |
| **Dart type** | **Description** |
|---------------------------------------------------------------------------------------------|------------------------------------------------------------------|
| [Array]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Array-class.html) | A fixed-sized array of items. Supertype of type specific arrays. |
| [Pointer]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Pointer-class.html) | Represents a pointer into native C memory. |
| [Struct]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Struct-class.html) | The supertype of all FFI struct types. |
| [Union]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Union-class.html) | The supertype of all FFI union types. |
{:.table .table-striped }


Expand All @@ -230,13 +230,13 @@ you can use the [`package:ffigen`][ffigen] binding generator
to automatically create FFI wrappers from C header files.


[Abi]: {{site.dart_api}}/stable/dart-ffi/Abi-class.html
[Abi]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/Abi-class.html
[binding]: {{site.flutter_docs}}/development/platform-integration/c-interop
[FFI]: https://en.wikipedia.org/wiki/Foreign_function_interface
[hello_world]: {{page.hw}}
[primitives]: {{page.samples}}/primitives
[structs]: {{page.samples}}/structs
[sqlite]: https://github.com/dart-lang/sdk/tree/main/samples/ffi/sqlite
[mini tutorial.]: https://github.com/dart-lang/sdk/blob/main/samples/ffi/sqlite/docs/sqlite-tutorial.md
[`NativeType`]: {{site.dart_api}}/stable/dart-ffi/NativeType-class.html
[`NativeType`]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-ffi/NativeType-class.html
[ffigen]: {{site.pub-pkg}}/ffigen
8 changes: 4 additions & 4 deletions src/codelabs/async-await.md
Original file line number Diff line number Diff line change
Expand Up @@ -631,10 +631,10 @@ that does the following:
* Example return value from `changeUsername()`: `"jane_smith_92"`
* Catches any error that occurs and returns the string value of the error.
* You can use the
[toString()]({{site.dart_api}}/stable/dart-core/ArgumentError/toString.html)
[toString()]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/ArgumentError/toString.html)
method to stringify both
[Exceptions]({{site.dart_api}}/stable/dart-core/Exception-class.html) and
[Errors.]({{site.dart_api}}/stable/dart-core/Error-class.html)
[Exceptions]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/Exception-class.html) and
[Errors.]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/Error-class.html)

{% comment %}
PENDING: Any way to auto-include this code?
Expand Down Expand Up @@ -1046,7 +1046,7 @@ If you're interested in using embedded DartPads, like this codelab does, see
[best practices for using DartPad in tutorials]: /resources/dartpad-best-practices
[Dart videos]: https://www.youtube.com/playlist?list=PLjxrf2q8roU0Net_g1NT5_vOO3s_FR02J
[article]: https://medium.com/dartlang/dart-asynchronous-programming-isolates-and-event-loops-bffc3e296a6a
[Future]: {{site.dart_api}}/stable/dart-async/Future-class.html
[Future]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-async/Future-class.html
[style guide]: /guides/language/effective-dart/style
[documentation guide]: /guides/language/effective-dart/documentation
[usage guide]: /guides/language/effective-dart/usage
Expand Down
16 changes: 8 additions & 8 deletions src/codelabs/iterables.md
Original file line number Diff line number Diff line change
Expand Up @@ -1187,11 +1187,11 @@ here are some suggestions for where to go next:
* Read the [Iterable API reference][iterable class]
to learn about methods not covered by this codelab.

[hashmap class]: {{site.dart_api}}/stable/dart-collection/HashMap-class.html
[iterable class]: {{site.dart_api}}/stable/dart-core/Iterable-class.html
[iterator class]: {{site.dart_api}}/stable/dart-core/Iterator-class.html
[list class]: {{site.dart_api}}/stable/dart-core/List-class.html
[map class]: {{site.dart_api}}/stable/dart-core/Map-class.html
[set class]: {{site.dart_api}}/stable/dart-core/Set-class.html
[StateError class]: {{site.dart_api}}/stable/dart-core/StateError-class.html
[String class]: {{site.dart_api}}/stable/dart-core/String-class.html
[hashmap class]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-collection/HashMap-class.html
[iterable class]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/Iterable-class.html
[iterator class]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/Iterator-class.html
[list class]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/List-class.html
[map class]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/Map-class.html
[set class]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/Set-class.html
[StateError class]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/StateError-class.html
[String class]: {{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/String-class.html
8 changes: 5 additions & 3 deletions src/null-safety/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ everything is fully migrated and the code switches to running with sound null
safety, it will be possible for `arg` to be null.

The simplest way to preserve behavior is change the check into
[`ArgumentError.checkNotNull`](https://api.dart.dev/stable/dart-core/ArgumentError/checkNotNull.html).
[`ArgumentError.checkNotNull`]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/ArgumentError/checkNotNull.html).

The same applies to some runtime type checks. If `arg`
has static type `String`, then `if (arg is! String)` is actually checking
Expand Down Expand Up @@ -213,7 +213,7 @@ In such cases, you have two options:
## How do I signal that the return value from a Map is non-nullable?

The
[lookup operator](https://api.dart.dev/stable/dart-core/Map/operator_get.html)
[lookup operator]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/Map/operator_get.html)
on Map (`[]`) by default returns a nullable type. There's no way to signal to
the language that the value is guaranteed to be there.

Expand Down Expand Up @@ -245,7 +245,9 @@ This implies `fooList` might contain null values. This might happen if you are
initializing the list with length and filling it in via a loop.

If you are simply initializing the list with the same value, you should instead
use the [`filled`](https://api.dart.dev/stable/dart-core/List/List.filled.html) constructor.
use the
[`filled`]({{site.dart_api}}/{{site.data.pkg-vers.SDK.channel}}/dart-core/List/List.filled.html)
constructor.

{:.bad}
{% prettify dart tag=pre+code %}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/dart-compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,4 @@ see [Web deployment](/web/deployment).
[webdev]: /tools/webdev
[`webdev build`]: /tools/webdev#build
[`webdev serve`]: /tools/webdev#serve
[Dart runtime]: /overview#runtime
[Dart runtime]: /overview#runtime

0 comments on commit b21f52c

Please sign in to comment.