Skip to content

Flutter Mockzilla

The Mockzilla Flutter plugin package is implemented as a federated plugin package. It calls through to the KMP library utilising Pigeon platform channels; this decision was made to ensure that the Flutter package remains aligned with the underlying KMM package but also removes the complexity developers face with method channels.

The federated packages are:

  • mockzilla — the public Dart API
  • mockzilla_platform_interface — the abstract platform contract
  • mockzilla_android — Android implementation
  • mockzilla_ios — iOS implementation
  • mockzilla_web — Web implementation, backed by Mock Service Worker

Handling package inter-dependencies

To handle the package inter-dependencies and minimise boilerplate in continuous integration scripts, the repository utilises melos. Once you have checked out the repository, install Melos with the following command.

dart pub global activate melos

Once installed, cd into the FlutterMockzilla/ directory and run the following command, which will override package inter-dependencies with the versions on your local machine.

melos bootstrap

Model generation

Immutable model classes are generated using the freezed package. The generated classes include utility methods such as copyWith() and ==. When editing model class definitions, make sure to run the following command to update the generated code.

dart run build_runner build

Alternatively, start a background process to watch the project files and automatically update the generated code in response to changes.

dart run build_runner watch