어플리케이션이 고도화 되기 위해서는 딥링크가 필수적이라고 판단한다.
때문에 네비게이션 혹은 라우터 구성과 동시에 진행하려한다.
플러터 딥링크를 검색하면(당연히 구글) 아래와 같은 공식 문서가 나온다.
https://docs.flutter.dev/development/ui/navigation/deep-linking
Deep linking
Navigate to routes when the app receives a new URL
docs.flutter.dev
가장 처음에는 공식문서의 안내를 따라가는 것을 권장한다.(거의 당연시함)
- Android 설정 in AndroidManifest.xml
- activity 태그 내의 맨 하단에 작성해준다.
- customScheme 와 myHost.name.com은 원하는 대로 작성해주면된다.
나는 회사명 그리고 프로젝트명을 활용하여 작성하였다.
- iOS 설정 in Info.plist
- dict 태그 내의 맨 하단에 작성해준다.
- CFBundleURLSchemes 과 CFBundleURLName 또한 안드로이드와 마찬가지로 작성한다.
가능하면 동일하게 작성해주는게 관리에 편할듯하다.
기본적인 Android와 iOS 셋팅은 끝났다.
이제 DeepLinking이 가능 하게끔 코드를 구성해보자.
https://docs.flutter.dev/development/ui/navigation
Navigation and routing
Overview of Flutter's navigation and routing features
docs.flutter.dev
위 링크를 보면 go_router 사용을 안내해준다. 가보자.
https://pub.dev/documentation/go_router/latest/index.html
go_router - Dart API docs
go_router A declarative routing package for Flutter that uses the Router API to provide a convenient, url-based API for navigating between different screens. You can define URL patterns, navigate using a URL, handle deep links, and a number of other naviga
pub.dev
'Dart > Flutter' 카테고리의 다른 글
[Flutter] SliverPersistentHeaderDelegate AutoCalculate Height (0) | 2023.06.14 |
---|---|
[Flutter][KakaoLogin] 플러터 카카오 로그인 구현 (1. 설정) (0) | 2023.04.23 |
[Flutter] apply? copyWith? in TextTheme (0) | 2022.11.18 |
[Flutter] Widget에 Border 추가하기 (0) | 2022.11.17 |
[Flutter] StatefulWidget 알아보기 (0) | 2022.11.16 |
댓글