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

Bài đăng

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

LocalSend: truyền file kiểu AirDrop không cần cloud

LocalSend hỏi một câu sản phẩm sắc: hai thiết bị đổi file không cần tài khoản server được không? Có — nếu bạn thiết kế discovery LAN, HTTPS và consent rõ ràng. Điểm thiết kế Peer protocol trên HTTPS cục bộ (thường gắn với cổng 53317 ). UI Flutter với phần Rust/native cho đường nhạy hiệu năng. Không có control plane cloud — privacy là feature. Học theo Discovery + consent UX là nửa sản phẩm. Transfer phải resume được và hiện rõ; lỗi im lặng phá niềm tin. Giữ CLI headless cho power user và automation. Cạm bẫy Giới hạn background mobile giết transfer dài ngây thơ. Mạng hỗn hợp (AP isolation, VPN, captive portal) sinh support load — hãy tài liệu hóa. Học LocalSend khi cần pattern local-first , không chỉ một package để copy. 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.

LocalSend: AirDrop-style transfer with zero cloud

LocalSend answers a sharp product question: can two devices exchange files without an account or a server? Yes — if you design for LAN discovery, HTTPS, and explicit consent. Design highlights Peer protocol over local HTTPS (commonly associated with port 53317 ). Flutter UI with Rust/native pieces for performance-critical paths. No cloud control plane — privacy is the feature. Steal this Discovery + consent UX is half the product. Make transfers resumable and visible; silent failures destroy trust. Keep a CLI headless mode for power users and automation. Pitfalls Mobile OS background limits kill naive long transfers. Mixed networks (AP isolation, VPN, captive portals) will generate support load — document them. Study LocalSend when you need local-first product patterns, not just a package to copy. Originally published on FlutterCook . Read the latest version there — that copy is the one kept up to date.

Hiddify Next: UI Flutter trên lõi tunnel

Client proxy/VPN sống ở rìa quyền OS. Hiddify Next ghép UI Flutter với lõi tunnel hiệu năng cao (dòng Sing-box/Go) để UI vẫn biểu đạt trong khi data path nhàm chán và nhanh. Bài học Status là stream. Latency, server đang nối, lỗi phải là một model nhất quán. Config là data. Import/export profile; đừng hardcode endpoint trong widget. API VPN nền tảng là phần khó — cô lập sau service interface. Cạm bẫy Pin và thermal khi tunnel always-on. Chính sách store khác nhau cho app VPN. Dùng repo này khi cần tham chiếu Flutter backed by service , không chỉ CRUD thuần. 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.

Hiddify Next: Flutter UI over a tunnel core

Proxy/VPN clients live at the edge of OS permissions. Hiddify Next pairs a Flutter UI with a high-performance tunnel core (Sing-box/Go lineage) so the UI stays expressive while the data path stays boring and fast. Lessons Status is a stream. Latency, connected server, and errors should be one consistent model. Config as data. Import/export profiles; do not hardcode endpoints in widgets. Platform VPN APIs are the hard part — isolate them behind a service interface. Pitfalls Battery and thermal costs of always-on tunnels. Store policy differences for VPN apps. Use this repo when you need a reference for service-backed Flutter rather than a pure CRUD app. Originally published on FlutterCook . Read the latest version there — that copy is the one kept up to date.

Dio: networking có thể ghép bằng interceptor

Dio: networking có thể ghép bằng interceptor dio đáng chú ý vì nó giải quyết interceptor, hủy request, retry và ánh xạ lỗi có kiểu. Bài này trình bày cách đặt package vào đúng boundary của một ứng dụng Flutter production thay vì chỉ copy một snippet vào màn hình. Package này sở hữu phần nào? Giữ API của package ở một adapter hoặc feature boundary có tên rõ ràng. Đưa lifecycle, lỗi và trạng thái loading vào contract mà UI có thể kiểm thử. Chỉ expose capability cần thiết; đừng để toàn app phụ thuộc vào chi tiết triển khai. Snippet bắt đầu final dio = Dio ( BaseOptions (baseUrl : apiBaseUrl)); dio.interceptors. add ( InterceptorsWrapper ( onRequest : (options, handler) { options.headers[ 'Authorization' ] = 'Bearer $ token ' ; handler. next (options); }, onError : (error, handler) { logApiFailure (error); handler. next (error); }, )); Checklist trước khi ship Đọc README và changelog của package đúng version đang pin. ...

Dio: composeable networking with interceptors

Dio: composeable networking with interceptors dio is useful because it focuses on interceptors, cancellation, retries, and typed error mapping. The important engineering move is to place the package behind a clear boundary, so your Flutter UI depends on a stable capability rather than a vendor-shaped API. What the library should own Keep package calls inside a named adapter or feature boundary. Make lifecycle, errors, and loading state part of a testable contract. Expose only the capability the app needs; hide implementation details from the whole tree. A focused starting point final dio = Dio ( BaseOptions (baseUrl : apiBaseUrl)); dio.interceptors. add ( InterceptorsWrapper ( onRequest : (options, handler) { options.headers[ 'Authorization' ] = 'Bearer $ token ' ; handler. next (options); }, onError : (error, handler) { logApiFailure (error); handler. next (error); }, )); Production checklist Read the README and ch...

HTTP in Flutter: timeouts, retries, and cancellation — hướng dẫn Flutter

Mobile networks lie. Timeouts and cancel tokens are mandatory. 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 dio interceptors that do not hang the UI forever. 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ế One retry with backoff; do not hammer APIs from flaky clients. 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 trả về data có kiểu hoặc failure có kiểu...

HTTP in Flutter: timeouts, retries, and cancellation

Mobile networks lie. Timeouts and cancel tokens are mandatory. 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 dio interceptors that do not hang the UI forever. 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 One retry with backoff; do not hammer APIs from flaky clients. 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 controller or use case validates the inten...

Certificate Transparency and mobile network trust — hướng dẫn Flutter

CT helps detect mis-issued certs for your API domains. 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 Why CT matters for API domains and how to monitor. 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ế Monitor CT logs for unexpected issuances. 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 trả về data có kiểu hoặc failure có kiểu, không trả string chỉ dành ...

Certificate Transparency and mobile network trust

CT helps detect mis-issued certs for your API domains. 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 Why CT matters for API domains and how to monitor. 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 Monitor CT logs for unexpected issuances. 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 controller or use case validates the intent and calls the boundary. T...

Dio: composeable networking with interceptors

Dio: composeable networking with interceptors dio is useful because it focuses on interceptors, cancellation, retries, and typed error mapping. The important engineering move is to place the package behind a clear boundary, so your Flutter UI depends on a stable capability rather than a vendor-shaped API. What the library should own Keep package calls inside a named adapter or feature boundary. Make lifecycle, errors, and loading state part of a testable contract. Expose only the capability the app needs; hide implementation details from the whole tree. A focused starting point final dio = Dio ( BaseOptions (baseUrl : apiBaseUrl)); dio.interceptors. add ( InterceptorsWrapper ( onRequest : (options, handler) { options.headers[ 'Authorization' ] = 'Bearer $ token ' ; handler. next (options); }, onError : (error, handler) { logApiFailure (error); handler. next (error); }, )); Production checklist Read the README and ch...

Certificate pinning and network security on mobile — hướng dẫn Flutter

Pinning reduces MITM risk but causes outages if rotated wrong. 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 When pinning helps and when it breaks you. 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ế Prefer backup pins and short-lived leaves. 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 trả về data có kiểu hoặc failure có kiểu, không trả string chỉ dành...

Certificate pinning and network security on mobile

Pinning reduces MITM risk but causes outages if rotated wrong. 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 When pinning helps and when it breaks you. 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 Prefer backup pins and short-lived leaves. 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 controller or use case validates the intent and calls the boundary. ...

HTTP in Flutter: timeouts, retries, and cancellation — hướng dẫn Flutter

Mobile networks lie. Timeouts and cancel tokens are mandatory. 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 dio interceptors that do not hang the UI forever. 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ế One retry with backoff; do not hammer APIs from flaky clients. 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 trả về data có kiểu hoặc failure có kiểu...

Certificate Transparency and mobile network trust — hướng dẫn Flutter

CT helps detect mis-issued certs for your API domains. 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 Why CT matters for API domains and how to monitor. 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ế Monitor CT logs for unexpected issuances. 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 trả về data có kiểu hoặc failure có kiểu, không trả string chỉ dành ...

HTTP in Flutter: timeouts, retries, and cancellation

Mobile networks lie. Timeouts and cancel tokens are mandatory. 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 dio interceptors that do not hang the UI forever. 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 One retry with backoff; do not hammer APIs from flaky clients. 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 controller or use case validates the inten...

Certificate pinning and network security on mobile — hướng dẫn Flutter

Pinning reduces MITM risk but causes outages if rotated wrong. 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 When pinning helps and when it breaks you. 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ế Prefer backup pins and short-lived leaves. 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 trả về data có kiểu hoặc failure có kiểu, không trả string chỉ dành...

Certificate Transparency and mobile network trust

CT helps detect mis-issued certs for your API domains. 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 Why CT matters for API domains and how to monitor. 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 Monitor CT logs for unexpected issuances. 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 controller or use case validates the intent and calls the boundary. T...

Certificate pinning and network security on mobile

Pinning reduces MITM risk but causes outages if rotated wrong. 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 When pinning helps and when it breaks you. 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 Prefer backup pins and short-lived leaves. 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 controller or use case validates the intent and calls the boundary. ...

LocalSend: truyền file kiểu AirDrop không cần cloud

LocalSend hỏi một câu sản phẩm sắc: hai thiết bị đổi file không cần tài khoản server được không? Có — nếu bạn thiết kế discovery LAN, HTTPS và consent rõ ràng. Điểm thiết kế Peer protocol trên HTTPS cục bộ (thường gắn với cổng 53317 ). UI Flutter với phần Rust/native cho đường nhạy hiệu năng. Không có control plane cloud — privacy là feature. Học theo Discovery + consent UX là nửa sản phẩm. Transfer phải resume được và hiện rõ; lỗi im lặng phá niềm tin. Giữ CLI headless cho power user và automation. Cạm bẫy Giới hạn background mobile giết transfer dài ngây thơ. Mạng hỗn hợp (AP isolation, VPN, captive portal) sinh support load — hãy tài liệu hóa. Học LocalSend khi cần pattern local-first , không chỉ một package để copy. 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.