Flutter - packages install example

charcaters為例,下載檔案後, 將檔案裡面的pubspec.yaml 移到自己的專案,開啟後,更改專案名(我的是dart),於下方貼上:

dependencies: characters: ^1.0.0 //注意階級,為dependencies的下一層

儲存,VS code會自動執行pub get,如果沒自動就可自行在TERMINAL pub get , 如果是flutter 就 flutter pub get.

如此一來
import 'package:characters/characters.dart';
就可以使用了。

Comments

Popular posts from this blog

Go-VSCode -Autocomplete and Auto-import

Dart syntax - initSate,Build,deactive, Dispose