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

패키지 상세v2.0.5

fluro

Fluro는 와일드카드, 이름 매개변수 및 명확한 경로 정의와 같은 유연한 라우팅 옵션을 추가하는 null 안전한 Flutter 라우팅 라이브러리입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
2.3만
좋아요
891
Pub 점수
150

패키지 설치

flutter pub add fluro

패키지 개요

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

Fluro는 유연한 라우트 구성으로 네비게이션을 단순화하기 위해 설계된 null 안전한 Flutter 라우팅 라이브러리입니다. 와일드카드, 이름 붙은 매개변수 및 깔끔한 선언적 라우트 정의를 지원하여 여러 플랫폼에서 복잡한 네비게이션 흐름을 쉽게 관리할 수 있습니다. 동적 라우팅 패턴이 필요한 앱에 적합하며 코드의 가독성과 유지보수성을 향상시킵니다. 경량 구조와 Android, iOS, Web, macOS, Windows, Linux와의 호환성 덕분에 현대적인 Flutter 애플리케이션에 매우 유용한 선택입니다.

사용 사례

  • 동적 경로를 가진 복잡한 탐색
  • 파라미터화된 URL 라우팅
  • 크로스 플랫폼 앱 탐색
  • 모듈러 앱 아키텍처
  • 딥링크 지원
  • 경로 로직의 명확한 분리

주요 기능

  • 와일드카드 라우트 매칭
  • 이름 매개변수 지원
  • 선언적 라우트 정의
  • 널 안전한 API
  • 가볍고 성능이 뛰어남
  • Platform-agnostic

적합한 대상

  • 고급 라우팅이 필요한 개발자
  • 딥 링크 요구 사항이 있는 앱
  • 대규모 플러터 프로젝트
  • 클린 코드 구조를 우선시하는 팀
  • 다중 플랫폼을 대상으로 하는 프로젝트

고려 사항

  • 수동 경로 등록이 필요합니다
  • 제한된 내장형 탐색 상태 관리
  • 기본 내비게이터보다 학습 곡선이 더 가파르다
  • 활동적으로 유지 관리되지 않음(마지막 업데이트 2021)
  • 커뮤니티 지원은 주로 GitHub 이슈를 통해

원본 README

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

English | Português



The brightest, hippest, coolest router for Flutter.

Version Build Status

Features

  • Simple route navigation
  • Function handlers (map to a function instead of a route)
  • Wildcard parameter matching
  • Querystring parameter parsing
  • Common transitions built-in
  • Simple custom transition creation
  • Follows stable Flutter channel
  • Null-safety

Example Project

There is a pretty sweet example project in the example folder. Check it out. Otherwise, keep reading to get up and running.

Getting started

First, you should define a new FluroRouter object by initializing it as such:

final router = FluroRouter();

It may be convenient for you to store the router globally/statically so that you can access the router in other areas in your application.

After instantiating the router, you will need to define your routes and your route handlers:

var usersHandler = Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) {
  return UsersScreen(params["id"][0]);
});

void defineRoutes(FluroRouter router) {
  router.define("/users/:id", handler: usersHandler);

  // it is also possible to define the route transition to use
  // router.define("users/:id", handler: usersHandler, transitionType: TransitionType.inFromLeft);
}

In the above example, the router will intercept a route such as /users/1234 and route the application to the UsersScreen passing the value 1234 as a parameter to that screen.

Navigating

You can use FluroRouter with the MaterialApp.onGenerateRoute parameter via FluroRouter.generator. To do so, pass the function reference to the onGenerate parameter like: onGenerateRoute: router.generator.

You can then use Navigator.push and the flutter routing mechanism will match the routes for you.

You can also manually push to a route yourself. To do so:

router.navigateTo(context, "/users/1234", transition: TransitionType.fadeIn);

Class arguments

Don't want to use strings for params? No worries.

After pushing a route with a custom RouteSettings you can use the BuildContext.settings extension to extract the settings. Typically this would be done in Handler.handlerFunc so you can pass RouteSettings.arguments to your screen widgets.

/// Push a route with custom RouteSettings if you don't want to use path params
FluroRouter.appRouter.navigateTo(
  context,
  'home',
  routeSettings: RouteSettings(
    arguments: MyArgumentsDataClass('foo!'),
  ),
);

/// Extract the arguments using [BuildContext.settings.arguments] or [BuildContext.arguments] for short
var homeHandler = Handler(
  handlerFunc: (context, params) {
    final args = context.settings.arguments as MyArgumentsDataClass;

    return HomeComponent(args);
  },
);

카테고리

소스 저장소

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