Esta página ainda não foi traduzida, por isso é exibida em inglês. Ajude a traduzir

First 5 valid emails, normalized

Native is fine

Requirement

Signup input is messy: stray whitespace, mixed case, and a couple of strings that are not emails at all. Normalize each entry (trim, lowercase), keep only plausible emails (contains @ and a dot), and print the first five. The data is in the code below; both versions must print the lines shown under Expected output.

Expected output
ada@example.com
grace@hopper.dev
lin@lang.org
ken@unix.org
dennis@unix.org

Side by side

Native Dart

FxDart

Why they differ

They don't, and that is the point. map, where, and take ship on every Dart Iterable, they are lazy, and the two versions are the same pipeline with where spelled filter. For a short normalize-validate-truncate chain like this, plain Dart is every bit as clear — reach for it. FxDart earns its keep when the pipeline needs vocabulary Dart lacks (groupBy, scan, zip, concurrent…) or when the rest of the file already chains with fx; adding a dependency for this snippet alone buys nothing.

Benchmark

Apple M1 Max, 32 GB RAM · Dart 3.12.2 (AOT-compiled) · 2026-08-24

N = 100

Time Tie

Native Dart 5.2 µs
FxDart 4.6 µs

Peak memory Tie

Native Dart 16.4 MB
FxDart 16.5 MB

N = 10,000

Time Tie

Native Dart 563 µs
FxDart 518 µs

Peak memory Tie

Native Dart 19.9 MB
FxDart 20.0 MB

N = 1,000,000

Time FxDart wins

Native Dart 72.5 ms
FxDart 67.1 ms

Peak memory Tie

Native Dart 176.3 MB
FxDart 176.0 MB

Bars are medians of repeated timed iterations in fresh processes per side (small N is batched for timer resolution). Sides within 5% of each other — or within 0.6 ms, a difference no person can perceive — count as a tie; close relative races are re-measured up to 5 runs. In an app, anything under a few milliseconds is invisible to the user regardless of which bar is shorter. Memory is peak process RSS. The Dart VM and the dataset are identical on both sides, so the difference between the two bars is what the pipeline itself holds onto.