Skip to content

avoid_removed_fpdart_api

v1.0.0WarningConfigurablefpdart

This rule flags fpdart names that were removed in 1.0.0 — Tuple2, Tuple3, the Predicate class, idFuture, concatMap, bindWithIndex and plus — in files that import fpdart.

None of these compile against a 1.x fpdart, so the rule is aimed at migration rather than correctness: a codebase moving off 0.x, or a snippet copied from one of the many pre-2023 tutorials that still rank well in search results.

The value is the message. “Undefined name Tuple2” tells you something is wrong; “Tuple2 was removed in fpdart 1.0.0, use a Dart record” tells you what to do, without a trip to the changelog.

See also: fpdart changelog

final pair = Tuple2(1, 'a');
final isOdd = Predicate<int>((n) => n % 2 == 1);
final pair = (1, 'a'); // Dart records replaced Tuple2
final isOdd = isEven.negate; // function extensions replaced Predicate

The full 1.0.0 removals: Tuple2/Tuple3 → records, Predicate → the function extensions (negate, and, or, contramap), id/idFutureidentity, concatMap/bind/bindWithIndexflatMap, plusconcat, and the old concatflatten.

The rule only runs on files that import package:fpdart/. A removed name resolves to nothing, so without that gate the rule would fire on any unresolved identifier sharing the name — a project with its own Tuple2, or a plain typo in a file that has never heard of fpdart.

A name the project declares itself is not reported, since it resolves to that declaration.

bind and concat are not reported by default. They still exist in 1.x but mean different things than they did in 0.x, so copied code compiles and quietly does the wrong thing. A rule firing on a valid, current API is worse than the confusion it prevents — but a project mid-migration can add them through additional_removed.

analysis_options.yaml
many_lints:
rules:
avoid_removed_fpdart_api:
additional_removed:
- bind
- concat
Option Type Default Description
additional_removed list of strings [] Extra names to report. Unlike the built-in list these are reported even when they resolve, which is what makes bind/concat catchable during a migration

This rule is in the recommended preset, so it is on with preset: recommended or preset: opinionated. Add it to preset: core with avoid_removed_fpdart_api: true.

To turn it off:

many_lints.yaml
rules:
avoid_removed_fpdart_api: false

To keep the rule on but skip certain paths, use per-rule exclude.