패키지, 저장소 및 앱 카테고리 검색

패키지 상세v5.6.0

go_router_modular

GoRouter를 사용한 Flutter용 모듈식 라우팅 및 종속성 주입. 모듈 간 원활한 통신을 위한 이벤트 기반 아키텍처와 마이크로 프론트엔드 지원 기능을 제공합니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
303
좋아요
35
Pub 점수
140

패키지 설치

flutter pub add go_router_modular

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

GoRouter Modular은 모듈식 라우팅과 종속성 주입을 통해 GoRouter를 강화하는 Flutter 패키지로, 확장 가능한 앱 아키텍처를 가능하게 합니다. 모듈 간 이벤트 기반 통신을 지원하며 마이크로 프론트엔드 패턴을 촉진합니다. 대규모 애플리케이션을 위한 설계로, 코드 분리, 재사용성 및 독립적인 모듈 개발을 장려합니다. GoRouter와 원활하게 통합되며, 복잡한 탐색 및 모듈 컴포넌트 간 상태 관리를 위한 기능을 확장합니다.

사용 사례

  • 대규모 플러터 애플리케이션
  • 마이크로 프론트엔드 아키텍처
  • 모듈러 앱 개발
  • 독립 모듈 배포
  • 이벤트 기반의 모듈 간 통신
  • 확장 가능한 탐색 시스템

주요 기능

  • GoRouter를 사용한 모듈형 라우팅
  • 내장된 종속성 주입
  • 이벤트 기반 모듈 통신
  • 마이크로 프론트엔드 지원
  • 모듈 통합이 쉬움
  • 크로스 플랫폼 호환성

적합한 대상

  • 복잡한 Flutter 앱을 개발하는 개발자
  • 모듈러 아키텍처를 사용하는 팀
  • 재사용 가능한 UI 구성 요소가 필요한 프로젝트
  • 여러 기능 모듈을 가진 앱
  • 확장성을 우선시하는 엔지니어링 팀

고려 사항

  • GoRouter에 대한 이해 필요
  • 초보자를 위한 학습 곡선이 더 가파릅니다
  • 모듈 등록을 위한 추가 설정
  • 빌드 복잡성을 증가시킬 수 있습니다
  • 작은 앱보다는 큰 프로젝트에 적합

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Go Router Modular

🧩 GoRouter Modular 💉

Modular architecture, dependency injection & route management on top of GoRouter.

Pub Version Pub Points GitHub Stars License

GoRouter Modular brings a modular architecture on top of GoRouter, with per-module dependency injection and automatic dispose. Split a large app into independent, lazy-loaded feature modules — perfect for micro frontends and scalable, team-friendly codebases. 🚀

Read the Docs

💡 Inspired by flutter_modular by Flutterando — we're grateful for their contribution to the Flutter ecosystem.


✨ Features

🧩 Modular Architecture Independent, reusable feature modules
💉 Dependency Injection Built-in DI with automatic dispose
🛣️ GoRouter Integration Type-safe, declarative navigation
🎭 Event System Decoupled, event-driven communication between modules
🚀 Lazy Loading Modules load on demand with efficient memory management
🛡️ Type Safety Fully type-safe with compile-time checks

📦 Installation

flutter pub add go_router_modular

🚀 Quick Start

1. Configure & run — bootstrap in main.dart:

import 'package:flutter/foundation.dart'; // kDebugMode
import 'package:flutter/material.dart';
import 'package:go_router_modular/go_router_modular.dart';

import 'src/app_module.dart';
import 'src/app_widget.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  await Modular.configure(
    appModule: AppModule(),
    initialRoute: '/',
    // Logs only in debug builds — release stays quiet.
    debugLogDiagnostics: kDebugMode,
  );

  runApp(const AppWidget());
}

class AppWidget extends StatelessWidget {
  const AppWidget({super.key});

  @override
  Widget build(BuildContext context) => ModularApp.router(title: 'My App');
}

2. Compose modules — the root AppModule registers app-wide binds and mounts each feature:

class AppModule extends Module {
  @override
  void binds(Injector i) {
    i
      ..addSingleton<DioClient>((i) => DioClient())
      ..addSingleton<AuthStore>((i) => AuthStore());
  }

  @override
  List<ModularRoute> get routes => [
        ModuleRoute('/', module: HomeModule()),
        ModuleRoute('/profile', module: ProfileModule()),
      ];
}

3. Define a feature module — its own binds and routes, disposed automatically when you leave it:

class HomeModule extends Module {
  @override
  void binds(Injector i) => i.addSingleton<HomeController>((i) => HomeController());

  @override
  List<ModularRoute> get routes => [
        ChildRoute(
          '/',
          name: 'home',
          child: (context, state) => HomePage(controller: Modular.get<HomeController>()),
        ),
      ];
}

4. Navigate — named-only, type-safe:

context.goNamed('profile');            // replace the stack
context.pushNamed('home');             // push on top
final controller = Modular.get<HomeController>(); // resolve a dependency

🤖 Agent Skill

This repo ships an Agent Skill that teaches AI coding agents (Claude Code, Cursor, Codex, OpenCode, and others) the recommended conventions for this package — per-feature route files, named-only navigation, typed binds via the .. cascade, synchronous modules, and kDebugMode-gated logs. The agent then applies them automatically when you scaffold routes, modules, or navigation.

Install it into your project with one command (via the skills CLI):

npx skills add eduardohr-muniz/go_router_modular -s go-router-modular

The CLI detects your installed agents and drops the skill into the right place (e.g. .claude/skills/). Add -g to install it globally for every project.

Optional — events add-on

If your app uses the event system (EventModule, ModularEvent, ModularEventMixin) for decoupled cross-module communication, install the separate events skill too:

npx skills add eduardohr-muniz/go_router_modular -s go-router-modular-events

🤝 Contributing

Contributions are very welcome! Open an issue to discuss major changes, then submit a PR with a clear description of the edits.

📄 License

Distributed under the MIT license. See LICENSE for details.


Transform your Flutter app into a scalable, modular masterpiece. ✨

Contributors

카테고리

의존성

의존성 목록 4 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.