avoid-future-tostring
preset: recommended
Warns when a Future
is the target of the toString
method or is used in an interpolation.
Example
❌ Bad:
void main() {
final myFuture = Future.value(1);
print(myFuture.toString()); // LINT
print('hello $myFuture'); // LINT
}
✅ Good:
Future<void> withAwait() async {
final myFuture = Future.value(1);
print((await myFuture).toString());
print('hello ${(await myFuture)}');
}