[native_assets] Support dart pub global run (original) (raw)

now my package contains a mylib-exe.dart in bin directory and in my pubspec.yaml:

environment: sdk: ^3.3.0

executables: mylib-exe:

dependencies:

but after I install dart pub global activate mylib both --source git or --source path, and run mylib-exe in cmd, report error:

Invalid argument(s): Couldn't resolve native function 'mylib_open' in 'package:mylib/src/lib_mylib.dart' : No asset with id 'package:mylib/src/lib_mylib.dart' found. No available native assets. Attempted to fallback to process lookup. /opt/programs/flutter/bin/cache/dart-sdk/bin/dart: undefined symbol: mylib_open.

seems build script not triggered and .so file not generated, I edit mylib-exe in ~/.pub-cache/bin/mylib-exe:

--- /home/wesley/.pub-cache/bin/mylib 2024-06-19 16:19:36.250444945 +0800 +++ mylib 2024-06-19 16:19:25.571916616 +0800 @@ -12,7 +12,7 @@ if [ $exit_code != 253 ]; then exit $exit_code fi

still not work. How should I fix it, thanks~