Paginated product listing
Requirement
A small shop catalog: name, price, in-stock flag. Show page 2 of the in-stock products, sorted by price ascending, three per page — one line per product. The data is in the code below; both versions must print the lines shown under Expected output.
Expected output
Page 2 of in-stock products: Milk Frother — $24.90 Cold Brew Jar — $27.80 Scale — $42.00
Side by side
Native Dart
FxDart
Why they differ
They barely do — this is a tie, and it is worth saying plainly.
Pagination is exactly the shape Dart's Iterable already
covers: skip and take read just as well as
FxDart's drop and take, and both stay lazy.
The only native wrinkle is sorting by a key — core Dart needs a
comparator (package:collection's sortedBy
closes even that). Pick FxDart here only if the rest of the codebase
already speaks its vocabulary; plain Dart loses nothing on this task.
Benchmark
N = 100
Time Tie
Peak memory Tie
N = 10,000
Time Tie
Peak memory Native wins
N = 1,000,000
Time Native wins
Peak memory Native wins
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.