Why Dart Developers Are Ditching Mockito for Faster, Cleaner Unit Testing
A software engineer argues that Mockito, once the standard mocking library for Dart, has become a liability in modern Flutter development due to its reliance on build_runner for code generation. When Dart introduced sound null safety in version 2.12, Mockito lost its runtime magic and was forced to generate boilerplate code at compile time, adding significant delays to the development cycle. This code generation can take anywhere from 15 seconds to two minutes on large codebases, breaking the tight feedback loops essential to Test-Driven Development. The approach also produces thousands of lines of machine-generated files that clutter repositories, complicate pull request reviews, and cause difficult merge conflicts. The author contends that better alternatives now exist and that continuing to use Mockito imposes unnecessary engineering overhead on modern Dart projects.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in