Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn Assets

Chỉ ship asset mà từng nền tảng cần

Một danh sách flutter: assets từng khiến mọi nền tảng nhận mọi file. Từ 3.41 bạn lọc được: flutter : assets : - path : assets/logo.png - path : assets/web_worker.js platforms : [ web ] - path : assets/desktop_icon.png platforms : [ windows , linux , macos ] Vì sao app đa nền tảng nên làm User mobile không nên tải PDF hướng dẫn desktop hay web worker. Metric dung lượng store và ma sát download cải thiện ngay. CI assert được ma trận asset theo nền tảng. Cách chia thực tế Loại asset Nền tảng Branding dùng chung all Web worker / helper wasm web Template in ấn độ phân giải cao desktop Nhạc notification iOS/Android android, ios Cạm bẫy rootBundle.load asset không tồn tại trên nền tảng sẽ throw — guard bằng platform check. Đây là lọc đóng gói , không phải theming runtime. Bài viết gốc đăng tại FlutterCook . Bản trên đó là bản được cập nhật mới nhất.

Ship only the assets each platform needs

One flutter: assets list used to mean every platform received every file. From 3.41 you can filter: flutter : assets : - path : assets/logo.png - path : assets/web_worker.js platforms : [ web ] - path : assets/desktop_icon.png platforms : [ windows , linux , macos ] Why this is not optional for multi-platform apps Mobile users should not download desktop help PDFs or web workers. Store size metrics and download friction improve immediately. CI can assert platform asset matrices in tests. Practical split Asset type Platforms Shared branding all Web workers / wasm helpers web High-res print templates desktop iOS/Android notification sounds android, ios Pitfalls Conditional rootBundle.load of a missing platform asset throws — guard with a platform check. This is packaging filtering, not runtime theming. Originally published on FlutterCook . Read the latest version there — that copy is the one kept up to date.