Search

pub

pub

Dart ์–ธ์–ด์˜ ํŒจํ‚ค์ง€ ๋งค๋‹ˆ์ €
Dart ํ”„๋กœ์ ํŠธ์—์„œ ์ข…์†์„ฑ์„ ๊ด€๋ฆฌํ•˜๊ณ  ํŒจํ‚ค์ง€๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. Flutter ํ”„๋กœ์ ํŠธ์—์„œ๋„ pub์„ ์‚ฌ์šฉํ•˜์—ฌ ํŒจํ‚ค์ง€๋ฅผ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.

๋ชฉ์ฐจ

โ€ข
pub.dev
โ€ข
pub ๋ช…๋ น์–ด

pub.dev

Dart ํ”„๋กœ๊ทธ๋ž˜๋ฐ ์–ธ์–ด์™€ Flutter๋ฅผ ์œ„ํ•œ ํŒจํ‚ค์ง€ ๋ฐ ํ”Œ๋Ÿฌ๊ทธ์ธ์˜ ์ €์žฅ์†Œ

ํŒจํ‚ค์ง€ ๊ฒ€์ƒ‰

ํŒจํ‚ค์ง€ ์„ค์น˜ ๋ฐฉ๋ฒ•

pub ๋ช…๋ น์–ด

โ€ข
flutter pub get
โ€ข
flutter pub add <package_name>
โ€ข
flutter pub upgrade
โ€ข
flutter pub downgrade <package_name>
โ€ข
flutter pub build
โ€ข
flutter pub run <package_name>:<script_name>
โ€ข
flutter pub cache clean

pub get

flutter pub get
YAML
๋ณต์‚ฌ
โ€ข
ํ”„๋กœ์ ํŠธ์˜ pubspec.yaml ํŒŒ์ผ์— ๋ช…์‹œ๋œ ์ข…์†์„ฑ์„ ๊ฐ€์ ธ์˜ค๊ณ  ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.
โ€ข
Flutter ํ”„๋กœ์ ํŠธ์—์„œ๋Š” ์ด ๋ช…๋ น์„ ์‚ฌ์šฉํ•˜์—ฌ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.

pub add <package_name>

flutter pub add <package_name>
Bash
๋ณต์‚ฌ
โ€ข
์ง€์ •ํ•œ <package_name> ๋ฅผ pubspec.yaml ์˜ dependencies ์— ์ถ”๊ฐ€ํ•˜๊ณ , ํŒจํ‚ค์ง€๋ฅผ ๋‹ค์šด๋กœ๋“œ ๋ฐ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

pub upgrade

flutter pub upgrade
YAML
๋ณต์‚ฌ
โ€ข
ํ”„๋กœ์ ํŠธ์˜ ์ข…์†์„ฑ์„ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ์—…๊ทธ๋ ˆ์ด๋“œํ•ฉ๋‹ˆ๋‹ค.
โ€ข
pubspec.yaml ํŒŒ์ผ์—์„œ ํ˜„์žฌ ์‚ฌ์šฉ ์ค‘์ธ ํŒจํ‚ค์ง€์˜ ์ตœ์‹  ๋ฒ„์ „์„ ๊ฐ€์ ธ์˜ค๋ ค๋ฉด ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

pub downgrade

flutter pub downgrade <package_name>
YAML
๋ณต์‚ฌ
โ€ข
์ข…์†์„ฑ์„ ํŠน์ • ๋ฒ„์ „์œผ๋กœ ๋‹ค์šด๊ทธ๋ ˆ์ด๋“œํ•ฉ๋‹ˆ๋‹ค.
โ€ข
ํŠน์ • ํŒจํ‚ค์ง€์˜ ์ด์ „ ๋ฒ„์ „์œผ๋กœ ๋Œ์•„๊ฐ€๋ ค๋ฉด ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

pub build

flutter pub build
YAML
๋ณต์‚ฌ
โ€ข
ํ”„๋กœ๋•์…˜์šฉ ์ฝ”๋“œ๋ฅผ ๋นŒ๋“œํ•ฉ๋‹ˆ๋‹ค.
โ€ข
์ผ๋ฐ˜์ ์œผ๋กœ ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ฐฐํฌํ•  ๋•Œ ํ”„๋กœ๋•์…˜ ๋นŒ๋“œ๋ฅผ ์ƒ์„ฑํ•  ๋•Œ ์ด ๋ช…๋ น์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

pub run

flutter pub run <package_name>:<script_name>
YAML
๋ณต์‚ฌ
โ€ข
Dart ํŒจํ‚ค์ง€๋‚˜ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.
โ€ข
ํŠน์ • ํŒจํ‚ค์ง€์— ํฌํ•จ๋œ ์‹คํ–‰ ๊ฐ€๋Šฅํ•œ ์Šคํฌ๋ฆฝํŠธ๋ฅผ ์‹คํ–‰ํ•  ๋•Œ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

pub cache clean

flutter pub cache clean
YAML
๋ณต์‚ฌ
โ€ข
๋กœ์ปฌ ํŒจํ‚ค์ง€ ์บ์‹œ๋ฅผ ๊ด€๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
โ€ข
pub์€ ๋‹ค์šด๋กœ๋“œํ•œ ํŒจํ‚ค์ง€๋ฅผ ์บ์‹œ์— ์ €์žฅํ•˜๋ฏ€๋กœ, ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•˜๊ฑฐ๋‚˜ ํŒจํ‚ค์ง€๋ฅผ ์ œ๊ฑฐํ•ด์•ผ ํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.