Flutter 개발속도 향상법(packages)

김영진·2021년 7월 3일
0

Flutter 앱 개발 일기

목록 보기
12/31

목적

패키지를 통해 코드를 모듈화해 재사용성을 높히고 생산성을 증가시킨다.

내용

  • 라이브러리와 사용법은 거의 비슷하다.
  • 차이점은 자신의 프로젝트에 개인적으로 가지고 있다는 것
  • 따라서 구현하기가 매우 간단하다.

개발순서

  1. packages > authentication > pubspec.yaml 파일, 디렉토리 생성
  2. pubspec.yaml에 기존 프로젝트 내용을 복붙.
  3. name: authentication description: All authentication shared logic 으로 변경
  4. lib디렉토리를 authentication 하위에 생성 > authentication.dart 를 하위에 생성
  5. class Authentication {} in authentication.dart
  6. pubspec.yaml in main proj
    authentication :
      path: ./packages/authentication
  1. import package: authentication/authentication.dart

결과

내 프로젝트에 적용시켜보자...

profile
2021.05.03) Flutter, BlockChain, Sports, StartUp

0개의 댓글