assetId property

String? assetId
final

The ID of the asset in which symbol is resolved, if not using the default.

If no asset name is specified, the default is to use an asset ID specified using an DefaultAsset annotation on the current library's library declaration, and if there is no DefaultAsset annotation on the current library, the library's URI (as a string) is used instead.

Example (file package:a/a.dart):

@Native<Int64 Function(Int64, Int64)>()
external int sum(int a, int b);

Example 2 (file package:a/a.dart):

@DefaultAsset('package:a/a.dart')
library a;

import 'dart:ffi';

@Native<Int64 Function(Int64, Int64)>()
external int sum(int a, int b);

Example 3 (file package:a/a.dart):

@Native<Int64 Function(Int64, Int64)>(assetId: 'package:a/a.dart')
external int sum(int a, int b);

The above three examples are all equivalent.

Prefer using the library URI as an asset name over specifying it. Prefer using an DefaultAsset on the library declaration over specifying the asset name in a Native annotation.

Implementation

final String? assetId;