Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@jason-simmons
Copy link
Member

Tonic converters for simple types do not expect to receive nulls from Dart.
If the caller uses a null, then Tonic will pass the null to Dart APIs such as
Dart_GetNativeDoubleArgument which will return an error handle. Tonic then
ignores the error and returns a default value for the converted type.

This PR does an explicit mapping from nulls to default values and avoids the
unnecessary overhead of constructing the error in the Dart APIs.

Also add a test that checks function signatures in the dart:ui package for
nullable arguments of these types.

@jason-simmons jason-simmons requested a review from dnfield May 6, 2022 02:55
Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

We should also update the DartWrappable converter to check for null

…ve functions

Tonic converters for simple types do not expect to receive nulls from Dart.
If the caller uses a null, then Tonic will pass the null to Dart APIs such as
Dart_GetNativeDoubleArgument which will return an error handle.  Tonic then
ignores the error and returns a default value for the converted type.

This PR does an explicit mapping from nulls to default values and avoids the
unnecessary overhead of constructing the error in the Dart APIs.

Also add a test that checks function signatures in the dart:ui package for
nullable arguments of these types.
@jason-simmons jason-simmons force-pushed the native_no_null_primitives branch from cb9d717 to fcc7e89 Compare May 6, 2022 03:07
@jason-simmons jason-simmons added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label May 9, 2022
@fluttergithubbot fluttergithubbot merged commit 25fd0db into flutter:main May 9, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants