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

Bài đăng

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

Xử lý lỗi trong Flutter: bắt được thứ thật sự tới tay người dùng

Tỉ lệ không-sập 99,8% nghe rất đẹp cho tới khi bạn nhận ra nó chỉ đếm những cú sập mà công cụ báo cáo của bạn được nối để nhìn thấy. Trong Flutter, một lỗi có thể thoát ra qua bốn cánh cửa khác nhau, và phần lớn ứng dụng chỉ canh một hoặc hai. Bốn cánh cửa Cánh cửa Bắt được gì Bỏ sót gì nếu không nối FlutterError.onError Lỗi bên trong framework: build, layout, paint, callback cử chỉ Màn hình đỏ, lỗi bố cục âm thầm PlatformDispatcher.instance.onError Lỗi bất đồng bộ chưa bắt ở zone gốc Phần lớn lỗi Future Isolate.current.addErrorListener Lỗi trong các isolate bạn sinh ra Mọi lỗi tính toán chạy nền Bộ xử lý sập native Sập ở tầng nền tảng, mã native của plugin Bất cứ thứ gì giết tiến trình Đây là cả bốn, nối một lần lúc khởi động: Future < void > main () async { WidgetsFlutterBinding . ensureInitialized (); await Firebase . initializeApp (); final crashlytics = FirebaseCrashlytics .instance; // 1. Lỗi của framework. FlutterError...

Xử lý lỗi trong Flutter: bắt được thứ thật sự tới tay người dùng

Tỉ lệ không-sập 99,8% nghe rất đẹp cho tới khi bạn nhận ra nó chỉ đếm những cú sập mà công cụ báo cáo của bạn được nối để nhìn thấy. Trong Flutter, một lỗi có thể thoát ra qua bốn cánh cửa khác nhau, và phần lớn ứng dụng chỉ canh một hoặc hai. Bốn cánh cửa Cánh cửa Bắt được gì Bỏ sót gì nếu không nối FlutterError.onError Lỗi bên trong framework: build, layout, paint, callback cử chỉ Màn hình đỏ, lỗi bố cục âm thầm PlatformDispatcher.instance.onError Lỗi bất đồng bộ chưa bắt ở zone gốc Phần lớn lỗi Future Isolate.current.addErrorListener Lỗi trong các isolate bạn sinh ra Mọi lỗi tính toán chạy nền Bộ xử lý sập native Sập ở tầng nền tảng, mã native của plugin Bất cứ thứ gì giết tiến trình Đây là cả bốn, nối một lần lúc khởi động: Future < void > main () async { WidgetsFlutterBinding . ensureInitialized (); await Firebase . initializeApp (); final crashlytics = FirebaseCrashlytics .instance; // 1. Lỗi của framework. FlutterError...

Flutter error handling: catching what actually reaches users

A crash-free rate of 99.8% sounds excellent until you realise it only counts crashes your reporting tool was wired to see. In Flutter, an error can escape through four different doors, and most apps only guard one or two of them. The four doors Door Catches Missed if unwired FlutterError.onError Errors inside the framework: build, layout, paint, gesture callbacks Red screens, silent layout failures PlatformDispatcher.instance.onError Uncaught async errors in the root zone Most Future failures Isolate.current.addErrorListener Errors in isolates you spawned Every background-compute failure Native crash handler Platform-level crashes, plugin native code Anything that kills the process Here is all four, wired once at startup: Future < void > main () async { WidgetsFlutterBinding . ensureInitialized (); await Firebase . initializeApp (); final crashlytics = FirebaseCrashlytics .instance; // 1. Framework errors. FlutterError .onEr...

Vision models in production: the parts the demo skips

The demo works on the first try: photograph a receipt, get back structured JSON with the merchant, date and total. Then you ship it, and users send you a receipt photographed at an angle in bad light with a thumb over the total, a 40-page scanned contract, a screenshot of a spreadsheet, and a blurry photo of another screen showing a receipt. The model handles more of that than you would expect, and the parts it does not handle are the ones that determine whether the feature is usable. Resolution is the cost dial Images become tokens, and the count scales with pixel area. The precise formula differs by provider, but the shape is universal: a large image can cost more than a page of text, and most providers downscale images above a maximum dimension before processing anyway. Two consequences follow. Sending a full-resolution phone photo is usually waste. An 12-megapixel image gets downscaled by the provider, so you paid to upload pixels that were discarded. Resize before sending: ...

Flutter error handling: catching what actually reaches users

A crash-free rate of 99.8% sounds excellent until you realise it only counts crashes your reporting tool was wired to see. In Flutter, an error can escape through four different doors, and most apps only guard one or two of them. The four doors Door Catches Missed if unwired FlutterError.onError Errors inside the framework: build, layout, paint, gesture callbacks Red screens, silent layout failures PlatformDispatcher.instance.onError Uncaught async errors in the root zone Most Future failures Isolate.current.addErrorListener Errors in isolates you spawned Every background-compute failure Native crash handler Platform-level crashes, plugin native code Anything that kills the process Here is all four, wired once at startup: Future < void > main () async { WidgetsFlutterBinding . ensureInitialized (); await Firebase . initializeApp (); final crashlytics = FirebaseCrashlytics .instance; // 1. Framework errors. FlutterError .onEr...

Vision models in production: the parts the demo skips

The demo works on the first try: photograph a receipt, get back structured JSON with the merchant, date and total. Then you ship it, and users send you a receipt photographed at an angle in bad light with a thumb over the total, a 40-page scanned contract, a screenshot of a spreadsheet, and a blurry photo of another screen showing a receipt. The model handles more of that than you would expect, and the parts it does not handle are the ones that determine whether the feature is usable. Resolution is the cost dial Images become tokens, and the count scales with pixel area. The precise formula differs by provider, but the shape is universal: a large image can cost more than a page of text, and most providers downscale images above a maximum dimension before processing anyway. Two consequences follow. Sending a full-resolution phone photo is usually waste. An 12-megapixel image gets downscaled by the provider, so you paid to upload pixels that were discarded. Resize before sending: ...