Interview frequency: …
Short answer
Tie the operation to the owner's lifetime, cancel the subscription or use cancellation support, and check mounted before setState after an await.
Explanation
Real cancellation depends on the client; if unavailable, ignore the result after dispose and prevent races through a request id or a controller. Do not assume Future.timeout automatically cancels the work already on the network.
Common mistakes
- Calling setState after dispose.
- Treating a timeout as cancellation of the socket or server request.