Aer*_*ang 20 bundling-and-minification flutter flutter-dependencies flutter-packages
我在我的 flutter 项目中使用了一些不再需要的包,即wilddog_authand wilddog_sync,我可以从pubspec.yaml文件和我的 dart 文件中import 'package:wilddog_sync/wilddog_sync.dart'删除导入(也称为删除等)并删除 MainActivity.java 和 Xcode 项目中的导入,但是我无法清除 flutter、cocoapod 和 gradle 安装的未使用文件。现在flutter中有一个统一的命令可以一次删除所有未使用的包吗?
我敢肯定,使用flutter clean只删除build文件夹,并使用flutter packages get从删除软件包后pubspec.yaml不会删除软件包cocoapod或gradle两种。
例如,在flutter clean和flutter packages get我重建项目:
Launching lib/main.dart on Android SDK built for x86 64 in debug mode...
Initializing gradle...
Resolving dependencies...
Running 'gradlew assembleDebug'...
Built build/app/outputs/apk/debug/app-debug.apk.
Installing build/app/outputs/apk/app.apk...
I/FlutterActivityDelegate(11331): onResume setting current activity to this
I/Choreographer(11331): Skipped 107 frames! The application may be doing too much work on its main thread.
D/EGL_emulation(11331): eglMakeCurrent: 0x79f21b4dbec0: ver 2 0 (tinfo 0x79f219b4f160)
I/OpenGLRenderer(11331): Davey! duration=1903ms; Flags=1, IntendedVsync=7544454683637, Vsync=7546238016899, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=7546253803603, AnimationStart=7546253996603, PerformTraversalsStart=7546254171603, DrawStart=7546279222603, SyncQueued=7546288526603, SyncStart=7546295569603, IssueDrawCommandsStart=7546296644603, SwapBuffers=7546334455603, FrameCompleted=7546365204603, DequeueBufferDuration=2892000, QueueBufferDuration=199000,
Syncing files to device Android SDK built for x86 64...
D/ (11331): HostConnection::get() New Host Connection established 0x79f219ab81e0, tid 11383
D/EGL_emulation(11331): eglMakeCurrent: 0x79f21b5e26e0: ver 2 0 (tinfo 0x79f219aa66c0)
W/IInputConnectionWrapper(11331): getCursorCapsMode on inactive InputConnection
Run Code Online (Sandbox Code Playgroud)
然而,所有的包文件都保留了下来。
当然,我可以./ios/运行pods install以删除 pod:
pod install
Analyzing dependencies
Fetching podspec for `Flutter` from `.symlinks/flutter/ios`
Removing Wilddog
Removing WilddogCore
Removing WilddogSync
Downloading dependencies
Using Flutter (1.0.0)
Generating Pods project
Integrating client project
Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed.
[!] Automatically assigning platform `ios` with version `8.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See `https://guides.cocoapods.org/syntax/podfile.html#platform`.
Run Code Online (Sandbox Code Playgroud)
Man*_*ath 32
有一个直观的方法。安装这个包
dev_dependencies:
dependency_validator: ^x.x.x
Run Code Online (Sandbox Code Playgroud)
然后运行flutter pub run dependency_validator
它将显示有关已安装的软件包的所有详细信息。示例:=>
这些包固定在 pubspec.yaml 中:
这些包在 lib/ 中使用,但不是依赖项:
以下软件包包含可执行文件,假定使用它们:
这些包可能未使用,或者您可能正在使用这些包中的资产:
| 归档时间: |
|
| 查看次数: |
17409 次 |
| 最近记录: |