Flutter 查看库的依赖关系
oldbirds 6/6/2022 flutter
在 flutter 升级的时候,我们需要更新一些依赖库,但是往往会遇到一些第三方库不兼容问题,但报错信息只显示哪些库会冲突,你不知道这个库是在哪个库中所依赖的。
那么这个时候,要找到这些冲突库,我们需要知道库的依赖关系。很幸运,flutter 提供了这个功能。
我们只需要在项目根目录下,即项目 pubspec.yaml
同层目录下,执行:
flutter pub deps
显示结果如下:
Dart SDK 2.18.0-44.1.beta
Flutter SDK 3.1.0
demo 1.1.0+2022060601
|-- add_2_calendar 2.1.3
| '-- flutter...
|-- flutter_easyrefresh 2.2.2
| '-- flutter...
|-- flutter_gen_runner 4.1.6
| |-- build...
| '-- flutter_gen_core 4.2.1
| |-- analyzer...
| |-- args...
| |-- collection...
| |-- color 3.0.0
| |-- dart_style...
| |-- dartx 1.1.0
| | |-- characters...
| | |-- collection...
| | |-- crypto...
| | |-- meta...
| | |-- path...
| | '-- time 2.1.0
| | '-- clock...
| |-- json_annotation...
| |-- mime...
| |-- path...
| |-- pub_semver...
| |-- source_span...
| |-- xml...
| '-- yaml...
|-- flutter_html 2.2.1
| |-- chewie 1.3.3
| | |-- cupertino_icons...
| | |-- flutter...
| | |-- provider...
| | |-- video_player...
| | '-- wakelock...
| |-- chewie_audio 1.3.0
| | |-- cupertino_icons...
| | |-- flutter...
| | '-- video_player...
| |-- collection...
| |-- csslib 0.17.1
| | '-- source_span...
| |-- flutter...
| |-- flutter_layout_grid 1.0.6
| | |-- collection...
| | |-- flutter...
| | |-- meta...
| | '-- quiver...
| |-- flutter_math_fork...
| |-- flutter_svg 1.1.0
| | |-- flutter...
| | |-- meta...
| | |-- path_drawing 1.0.0
| | | |-- flutter...
| | | |-- meta...
| | | |-- path_parsing 1.0.0
| | | | |-- meta...
| | | | '-- vector_math...
| | | '-- vector_math...
| | |-- vector_math...
| | '-- xml...
| |-- html 0.15.0
| | |-- csslib...
| | '-- source_span...
| |-- numerus 1.1.1
| |-- video_player 2.4.2
| | |-- flutter...
| | |-- html...
| | |-- video_player_android 2.3.4
| | | |-- flutter...
| | | '-- video_player_platform_interface...
| | |-- video_player_avfoundation 2.3.4
| | | |-- flutter...
| | | '-- video_player_platform_interface...
| | |-- video_player_platform_interface 5.1.2
| | | |-- flutter...
| | | '-- plugin_platform_interface...
| | '-- video_player_web 2.0.10
| | |-- flutter...
| | |-- flutter_web_plugins...
| | '-- video_player_platform_interface...
| '-- webview_flutter...
|-- flutter_intl 0.0.1
| '-- flutter...
|-- flutter_keyboard_visibility 5.2.0
| |-- flutter...
| |-- flutter_keyboard_visibility_platform_interface 2.0.0
| | |-- flutter...
| | |-- meta...
| | '-- plugin_platform_interface...
| |-- flutter_keyboard_visibility_web 2.0.0
| | |-- flutter...
| | |-- flutter_keyboard_visibility_platform_interface...
| | '-- flutter_web_plugins...
| '-- meta...
|-- flutter_lints 2.0.1
| '-- lints 2.0.0
|-- flutter_localizations 0.0.0
| |-- characters...
| |-- clock...
| |-- collection...
| |-- flutter...
| |-- intl 0.17.0
| | |-- clock...
| | '-- path...
| |-- material_color_utilities...
| |-- meta...
| |-- path...
| '-- vector_math...
|-- flutter_math_fork 0.5.0
| |-- collection...
| |-- flutter...
| |-- flutter_svg...
| |-- meta...
| |-- provider...
| '-- tuple...
|-- flutter_opencc 0.0.3
| '-- flutter...
|-- flutter_picker 2.0.3
| '-- flutter...
|-- flutter_rating_bar 4.0.1
| '-- flutter...
|-- flutter_reachability 1.0.0
| '-- flutter...
|-- flutter_slidable 1.2.1
| '-- flutter...
|-- flutter_spinkit 5.1.0
| '-- flutter...
|-- flutter_swiper_null_safety 1.0.2
| '-- flutter...
|-- flutter_switch 0.3.2
| '-- flutter...
|-- flutter_test 0.0.0
| |-- async...
| |-- boolean_selector 2.1.0
| | |-- source_span...
| | '-- string_scanner...
| |-- characters...
| |-- charcode 1.3.1
| |-- clock...
| |-- collection...
| |-- fake_async 1.3.0
| | |-- clock...
| | '-- collection...
| |-- flutter...
| |-- matcher 0.12.11
| | '-- stack_trace...
| |-- material_color_utilities...
| |-- meta...
| |-- path...
| |-- source_span 1.8.2
| | |-- collection...
| | |-- path...
| | '-- term_glyph...
| |-- stack_trace...
| |-- stream_channel 2.1.0
| | '-- async...
| |-- string_scanner...
| |-- term_glyph 1.2.0
| |-- test_api 0.4.9
| | |-- async...
| | |-- boolean_selector...
| | |-- collection...
| | |-- matcher...
| | |-- meta...
| | |-- source_span...
| | |-- stack_trace...
| | |-- stream_channel...
| | |-- string_scanner...
| | '-- term_glyph...
| '-- vector_math...
|-- waterfall_flow 3.0.2
| |-- collection...
| |-- extended_list_library 3.0.0
| | '-- flutter...
| '-- flutter...
|-- webview_flutter 2.1.2
| |-- flutter...
| |-- webview_flutter_android 2.0.15
| | |-- flutter...
| | '-- webview_flutter_platform_interface...
| |-- webview_flutter_platform_interface 1.9.0
| | |-- flutter...
| | |-- meta...
| | '-- plugin_platform_interface 2.1.2
| | '-- meta...
| '-- webview_flutter_wkwebview 2.7.5
| |-- flutter...
| |-- path...
| '-- webview_flutter_platform_interface...
'-- wechat_assets_picker 7.3.1
|-- extended_image...
|-- flutter...
|-- photo_manager 2.1.2
| '-- flutter...
|-- provider...
'-- video_player...
然后我们在从中搜索冲突库,就很容易知道它被哪些库依赖了。