Skip to main content

Remove Page

This command allows you to safely remove a specific page (module) from a feature. It deletes the page's directory, its associated tests, and removes its registration from the dependency injection container.

morpheme remove-page [page_name] -f [feature_name]

Description

When you run this command, the CLI performs the following actions:

  1. Deletes Directory: Removes the page directory features/[feature_name]/lib/[page_name].
  2. Deletes Tests: Removes the associated test directory features/[feature_name]/test/[page_name]_test.
  3. Updates Locator: Deregisters the page's dependencies from features/[feature_name]/lib/locator.dart.
  4. Format: Runs dart format to clean up the code.

Usage

Remove a Page from a Standard Feature

To remove a page named login from the auth feature:

morpheme remove-page login -f auth

Remove a Page from an App-Specific Feature

To remove a page named dashboard from the home feature inside the driver app:

morpheme remove-page dashboard -f home -a driver

Options

morpheme remove-page [page_name] [options]

To see all available options and flags, run morpheme remove-page --help.

Available Options

OptionAbbrDescriptionMandatory
--feature-name-fName of the feature containing the page to remove.Yes
--apps-name-aName of the app containing the feature (for monorepo setup).No
Irreversible Action

This command permanently deletes the page directory and its tests. Ensure you have backed up your code or committed changes to version control before running this command.