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.

Ship only the assets each platform needs — hướng dẫn Flutter

One assets list used to mean every platform received every file. 3.41 filters by platform. Bài này chuyển quan sát đó thành một mô hình nhỏ để bạn có thể kiểm thử, đo lường và giữ cho code dễ bảo trì khi app lớn lên. Vấn đề cốt lõi pubspec platforms: keys keep desktop files out of mobile APKs. Câu hỏi hữu ích không phải API hay pattern có đẹp riêng lẻ hay không, mà là state nằm ở đâu, boundary nào chịu trách nhiệm khi lỗi xảy ra, và người dùng phục hồi thế nào khi happy path biến mất. Mô hình thực tế Store size metrics and download friction improve immediately. Hãy bắt đầu bằng một owner rõ ràng cho behavior. Widget chỉ nên render và phát intent; IO, persistence, permission và retry nên nằm sau một interface nhỏ. Nhờ vậy bạn có seam để fake trong test và một chỗ ghi lại các dữ kiện cần theo dõi ở production. Trong app Flutter, boundary thường có dạng: Widget phát intent như load, submit, refresh hoặc retry. Controller hoặc use case validate intent rồi gọi boundary. Boundary ...

Ship only the assets each platform needs

One assets list used to mean every platform received every file. 3.41 filters by platform. This article turns that observation into a small implementation model you can test, measure, and keep boring when the app grows. The problem in one sentence pubspec platforms: keys keep desktop files out of mobile APKs. The useful question is not whether the API or pattern looks elegant in isolation. It is where state lives, which boundary owns failure, and how a user recovers when the happy path disappears. A practical model Store size metrics and download friction improve immediately. Start with one explicit owner for the behavior. Keep widgets responsible for rendering and user intent; keep IO, persistence, permissions, and retries behind a small interface. That gives you a seam for a fake in tests and a place to record the facts that matter in production. For a Flutter app, the boundary usually looks like this: The widget emits an intent such as load, submit, refresh, or retry. A co...

Ship only the assets each platform needs — hướng dẫn Flutter

One assets list used to mean every platform received every file. 3.41 filters by platform. Bài này chuyển quan sát đó thành một mô hình nhỏ để bạn có thể kiểm thử, đo lường và giữ cho code dễ bảo trì khi app lớn lên. Vấn đề cốt lõi pubspec platforms: keys keep desktop files out of mobile APKs. Câu hỏi hữu ích không phải API hay pattern có đẹp riêng lẻ hay không, mà là state nằm ở đâu, boundary nào chịu trách nhiệm khi lỗi xảy ra, và người dùng phục hồi thế nào khi happy path biến mất. Mô hình thực tế Store size metrics and download friction improve immediately. Hãy bắt đầu bằng một owner rõ ràng cho behavior. Widget chỉ nên render và phát intent; IO, persistence, permission và retry nên nằm sau một interface nhỏ. Nhờ vậy bạn có seam để fake trong test và một chỗ ghi lại các dữ kiện cần theo dõi ở production. Trong app Flutter, boundary thường có dạng: Widget phát intent như load, submit, refresh hoặc retry. Controller hoặc use case validate intent rồi gọi boundary. Boundary ...

Ship only the assets each platform needs

One assets list used to mean every platform received every file. 3.41 filters by platform. This article turns that observation into a small implementation model you can test, measure, and keep boring when the app grows. The problem in one sentence pubspec platforms: keys keep desktop files out of mobile APKs. The useful question is not whether the API or pattern looks elegant in isolation. It is where state lives, which boundary owns failure, and how a user recovers when the happy path disappears. A practical model Store size metrics and download friction improve immediately. Start with one explicit owner for the behavior. Keep widgets responsible for rendering and user intent; keep IO, persistence, permissions, and retries behind a small interface. That gives you a seam for a fake in tests and a place to record the facts that matter in production. For a Flutter app, the boundary usually looks like this: The widget emits an intent such as load, submit, refresh, or retry. A co...

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.