我正在我的 M2 Macbook 上的 VS Code 中运行和调试一个 flutter 应用程序。但现在出现了一个问题,比如我在启动几秒钟后无法重新加载或重新启动应用程序。开发工具也没有出现。在 Windows 中也面临类似的问题,所以我认为这不是与平台相关的问题。
有人遇到过类似的问题吗?
这就是我得到的详细内容
\[+1987 ms\] Skipping target: gen_localizations
\[ +1 ms\] Skipping target: gen_dart_plugin_registrant
\[ \] Skipping target: \_composite
\[ \] complete
\[ +2 ms\] Performing hot restart...
\[ +26 ms\] Scanned through 1879 files in 22ms
\[ \] Syncing files to device Gokul’s iPhone...
\[ +2 ms\] \<- reset
\[ \] Compiling dart to kernel with 0 updated files
\[ \] Processing bundle.
\[ \] \<- recompile package:sample_app/main.dart 593be64a-7c40-4c54-84d1-f94eac8c8808
\[ \] \<- 593be64a-7c40-4c54-84d1-f94eac8c8808
\[ \] Bundle processing done.
\[ +67 ms\] Updating files.
\[+8701 ms\] DevFS: Sync finished
\[ \] Syncing files to device Gokul’s iPhone... (completed in 8.8s)
\[ \] Synced 93.4MB.
\[ \] \<- accept
\[+4097 ms\] Ignoring terminal input: "r" because we are busy.
这些是我正在使用的软件包:
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.6
hooks_riverpod: ^2.5.1
flutter_hooks: ^0.20.5
riverpod_annotation: ^2.3.5
fluro: ^2.0.5
logging: 1.1.0
logger: ^2.3.0
freezed: ^2.5.2
freezed_annotation: ^2.4.1
json_annotation: ^4.9.0
http: ^1.2.1
material_design_icons_flutter: ^7.0.7296
form_validator: ^2.1.1
fpdart: ^1.1.0
dotted_line: ^3.2.2
flutter_svg: ^2.0.10+1
slang: ^3.31.1
slang_flutter: ^3.31.0
intl: ^0.19.0
uuid: ^4.4.0
carousel_slider: ^5.0.0
flutter_card_swiper: ^7.0.1
lottie: ^3.1.2
jiffy: ^6.3.1
url_launcher: ^6.3.0
device_info_plus: ^10.1.2
connectivity_plus: ^6.0.5
shared_preferences: ^2.1.1
cunning_document_scanner: ^1.2.3
flutter_html: ^3.0.0-beta.2
firebase_core: ^3.4.1
firebase_messaging: ^15.1.1
flutter_secure_storage: ^9.2.2
isar: ^4.0.0-dev.14
isar_flutter_libs: ^4.0.0-dev.14
path_provider: ^2.1.4
permission_handler: ^11.3.1
envied: ^0.5.4+1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.0
riverpod_generator: ^2.4.0
build_runner: ^2.4.10
custom_lint: ^0.6.4
riverpod_lint: ^2.3.10
json_serializable: ^6.8.0
flutter_native_splash: ^2.4.1
flutter_launcher_icons: ^0.14.1
change_app_package_name: ^1.4.0
envied_generator: ^0.5.4+1
刚刚解决了这个问题。
我看到我使用的 isar 包由于对其缓存进行 2 次背对背写入而形成死锁,因此持有异步写入线程。
总而言之,真正的罪魁祸首是一个在后台运行的线程,这使得整个调试器没有响应。