Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 1.46 KB

File metadata and controls

20 lines (15 loc) · 1.46 KB

Architecture Decision: Rust vs Dart in Flutter

When to use Rust?

In the context of this project (and Flutter apps in general), we use Rust for:

  1. Advanced Networking & Security:

    • TLS Fingerprinting: Bypassing sophisticated bot detection (like Cloudflare) often requires low-level control over the TLS handshake (Client Hello), which Dart's http client doesn't fully expose. We use reqwest + rustls in Rust for this.
    • Custom Protocols: Implementing raw TCP/UDP protocols or specific encryption standards.
  2. High-Performance Computing:

    • Heavy Data Processing: Parsing massive binaries, cryptography, or complex algorithms where Dart's garbage collector might cause stutter (jank) in the UI.
    • Image/Video Processing: manipulating media frames in real-time.
  3. Cross-Platform Shared Logic:

    • Writing "Core Business Logic" once to run on Android, iOS, Windows, Linux, MacOS, and Web (via WASM) with identical behavior and performance.

Why Dart for the Parser?

For features like the Absensi (Attendance) parser:

  • Speed vs Overhead: HTML parsing is fast. The time it takes to send a string from Dart to Rust (FFI) and back often takes longer than just parsing it in Dart for small documents.
  • Developer Experience: UI features often change. Keeping the parsing logic in Dart (siakad_parser.dart) means you can hot-reload and see changes instantly. Rust requires a recompile (minutes) for every change.