nativeapi 0.5.7 does not compile on Dart 3.14 (beta): Isolate.create unshipped

未关闭
#22 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
dart, flutter
领域
desktop-dev

调研方向

Start by reading lib/nativeapi.dart and lib/src/run_native_app.dart, then reproduce the failure with the Dart 3.14 beta using the issue’s pubspec.yaml and dart compile kernel command. The suggested direction is to separate the runNativeApp export so unrelated users can compile; also investigate a Dart 3.14-compatible approach for its isolate APIs. Done means the reproduction compiles on the beta without requiring users who do not call runNativeApp to use the experimental flag.

由索引模型根据 Issue 内容生成。

描述

Problem

With the Dart 3.14 beta SDK (3.14.0-315.3.beta, Flutter beta 3.50.0-0.3.pre), any program importing package:nativeapi/nativeapi.dart 0.5.7 fails to compile:

nativeapi-0.5.7/lib/src/run_native_app.dart:45:25: Error: Member not found: 'Isolate.create'.
    final app = Isolate.create(debugName: 'nativeapi');
                        ^^^^^^

It compiles with Dart 3.13.7 (stable).

Cause

Dart 3.14 unships the experimental isolate APIs that were accidentally exposed in Dart 3.13 (dart-lang/sdk#64285, dart:isolate section of the 3.14 CHANGELOG): Isolate.create, Isolate.runSync and Isolate.runEventLoopSync are removed from dart:isolate, and NativeCallable.isolateGroupBound is now gated behind the --experimental-shared-data VM flag. runNativeApp in lib/src/run_native_app.dart uses all four.

lib/nativeapi.dart exports src/run_native_app.dart on every non-web platform, so the file is compiled for every user of the library, including Flutter apps that never call runNativeApp. That also covers every user of package:window_manager/window_manager.dart 0.6.0, which re-exports package:nativeapi/nativeapi.dart (a show list does not stop the library from being compiled). Their tests fail to load on the beta channel.

Reproduction

pubspec.yaml:

name: nativeapi_repro
publish_to: none
environment:
  sdk: ^3.13.0
dependencies:
  nativeapi: 0.5.7

bin/main.dart:

import 'package:nativeapi/nativeapi.dart';

void main() {
  print(WindowManager.instance);
}
dart pub get
dart compile kernel bin/main.dart

Dart 3.14.0-315.3.beta: the error above. Dart 3.13.7: compiles.

Suggestion

Moving runNativeApp out of nativeapi.dart into its own library (for example package:nativeapi/run_native_app.dart) would let Flutter apps and window_manager compile on Dart 3.14 again. runNativeApp itself needs another approach on 3.14, since NativeCallable.isolateGroupBound now requires --experimental-shared-data.

主要语言
TypeScript
星标
170
派生
15
平均合并
58 分钟
30 天内合并 PR
1

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

libnativeapi/nativeapi 的其他 Issue

查看 libnativeapi/nativeapi 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。