一键导入
create-module
Create a new Modugo module with routes, binds, and imports
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Create a new Modugo module with routes, binds, and imports
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
| name | create-module |
| description | Create a new Modugo module with routes, binds, and imports |
A module in Modugo extends Module and implements three methods: imports(), binds(), and routes().
Modulebinds() using i.register*routes() using the declarative DSLimports() if neededfinal class ProfileModule extends Module {
@override
List<Type> imports() => []; // shared modules to import
@override
void binds() {
i.registerFactory<ProfileRepository>(() => ProfileRepositoryImpl());
i.registerFactory<ProfileViewModel>(() => ProfileViewModel(i.get()));
}
@override
List<IRoute> routes() => [
child('/', builder: (_, _) => const ProfilePage()),
child('/edit', builder: (_, _) => const EditProfilePage()),
];
}
final class ProfileModule extends Module {
@override
void binds() {
i.registerFactory<ProfileRepository>(() => ProfileRepositoryImpl());
}
@override
List<IRoute> routes() => [
child(
'/',
builder: (_, _) => const ProfilePage(),
guards: [AuthGuard()],
),
];
}
@override
List<IRoute> routes() => [
child('/', builder: (_, _) => const HomePage()),
module('/profile', ProfileModule()),
];
i.get<T>(), Modugo.i.get<T>(), or context.read<T>()module() route propagate automatically to all child routesimports() to share a module's binds with child modules without re-registeringCreate and apply route guards in Modugo to protect routes with conditional logic
Create routes in Modugo using ChildRoute, ModuleRoute, ShellModuleRoute, StatefulShellModuleRoute, or AliasRoute
Register and access dependencies in Modugo modules using GetIt via the binds() method
Contexto completo do projeto Modugo — lib Flutter de roteamento modular e injeção de dependência sobre GoRouter + GetIt. Carregue esta skill sempre que for explorar, implementar, especificar ou revisar qualquer coisa no repositório.