본문 바로가기

개발하자

종속성을 변동시키기 위해 라이브러리를 추가하는 방법

반응형

종속성을 변동시키기 위해 라이브러리를 추가하는 방법

저는 flooting에 새로 왔고 Fast Android 네트워킹 라이브러리를 추가하여 의존성을 flooting하고 싶은데 어떻게 추가해야 할지 모르겠습니다. 아무나, 도와주세요.




플라우터 종속성에서 패키지를 추가하는 것은 매우 간단합니다. 당신이 해야 할 일은 그것을 파일 안에 넣는 것이다.

따라서 를 여십시오. 이 파일은 Floating 앱의 루트 프로젝트 폴더에 있습니다. 그리고 다음을 수행하여 새 종속성/라이브러리를 추가합니다:

dependencies:
  flutter:
    sdk: flutter
  # dependencies come below here
  example_dependency: ^3.2.0+1 // at the end is the version of the depenency
  second_example_dependecy: any // 'any' for any version of the dependecy

당신이 당신의 앱을 만드는 것을 돕기 위해 flatter와 dart 패키지를 찾을 수 있다.




프로젝트 루트에 있는 터미널 내에서 플래터 프로젝트에 패키지를 추가하려면 다음을 입력하십시오:

flutter pub add http

안정된 최신 버전이 사용될 것이다.

옵션에 대한 자세한 내용은 다음을 참조하십시오




루트 프로젝트 아래의 pubspec.yaml 파일을 열고 종속성/라이브러리를 추가합니다.

version: 1.0.0+1

environment:
  sdk: '>=3.0.3 <4.0.0'

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:
    sdk: flutter
  path: ^1.8.3
  sqflite: ^2.2.8+4
  # add this line to your dependencies
  fluttertoast: ^8.2.2

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^2.0.0

flutter:
  uses-material-design: true

  # Enable generation of localized Strings from arb files.
  generate: true

  assets:
    # Add assets from the images directory to the application.
    - assets/images/
    - assets/database/

반응형