Pular para o conteúdo principal
ProdutosFerramentas de desktopTASTECADVisualização de desenhosTASTEFILESGerenciamento de arquivosTASTEFTPTransferência de arquivosTASTESSHEspaço de trabalho remotoTASTEZIPCompactação e extraçãoTASTEWINMGerenciamento de arquivosFerramentas para desenvolvedoresTASTECODEAmbiente de desenvolvimento integrado para RustTASTESTUDIOAmbiente integrado de desenvolvimento e testesTASTEETLIntegração de dados (ETL)ServidoresTASTEREMOTEServidor de área de trabalho remotaTASTEGEOServidor geoespacialTASTEMAILEspaço de trabalho de e-mailInvestimentosTASTESTOCKAplicativo desktop de negociação automática de açõesComeçarDownloadsDocumentaçãoComprarTodos os produtos
Marketplace
Notícias
TecnologiaNotíciasNotícias de desenvolvimento de hojeDocumentaçãoLinguagens de programaçãoRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFrameworks de front-end webNext.jsReactVue.js · NuxtSvelteKitAngularFrameworks de servidorSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFrameworks de apps e desktopTauriFlutterReact NativeElectronAlgoritmosFundamentos de algoritmosAlgoritmos essenciaisAlgoritmos avançadosAlgoritmos práticos
ComunidadeProjetosRegistros de desenvolvimentoPromptsProblemas de ferramentas de IAVitrineGuia da comunidade
ColaboreTransferência técnicaConstrução de siteConstrução de app de desktopPipeline de lançamento e pagamentoParceiro de vendasContato
ServiçosÁrea de trabalho remotaPacotes de instalação sob medida
TASTEDEV
Produtos

Ferramentas de desktop

TASTECADDesenhos complexos, abertos com levezaTASTEFILESSó os arquivos de que você precisa, o mais rápido possívelTASTEFTPO caminho mais organizado para seus arquivosTASTESSHEntre você e o servidor, uma conexão mais sólidaTASTEZIPCompacte mais rápido, extraia com mais segurançaTASTEWINMUm gerenciador de arquivos de dois painéis feito para o teclado

Ferramentas para desenvolvedores

TASTECODEEdite, compile, depure e teste apps Rust em uma única janelaTASTESTUDIODa edição aos testes remotos e às correções com IA aprovadasTASTEETLMova dados de olho nos valores

Servidores

TASTEREMOTEUma área de trabalho remota rodando no seu próprio servidorTASTEGEOUm servidor geoespacial compatível com o GeoServer, reconstruído em RustTASTEMAILRetome o controle do seu e-mail

Investimentos

TASTESTOCKNegociação automática de ações pelas regras que você define: quando e o quê

Começar

DownloadsVersões mais recentes de cada produtoDocsComo usar cada produtoComprarAssinaturas e licenças perpétuasTodos os produtosTodos os produtos de relance
Todos os produtos
MarketplaceNotícias
Tecnologia

Notícias

Notícias de desenvolvimento de hojeAnúncios oficiais de linguagens, frameworks, GitHub e IADocumentaçãoGuias de linguagens, frameworks e algoritmos

Linguagens de programação

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Frameworks de front-end webNext.jsReactVue.js · NuxtSvelteKitAngular
Frameworks de servidorSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Frameworks de apps e desktopTauriFlutterReact NativeElectron

Algoritmos

Fundamentos de algoritmosAnálise de complexidade · Ordenação · Busca · Estruturas de dados básicas · Árvores e heapsAlgoritmos essenciaisBusca em grafos · Caminho mínimo e árvore geradora mínima · Programação dinâmica · Algoritmos gulosos · Divisão e conquista · BacktrackingAlgoritmos avançadosAlgoritmos de strings · Matemática e teoria dos números · Manipulação de bits · Árvores de segmentos · Union-FindAlgoritmos práticosEstratégia para entrevistas de código · Cache LRU · Limitação de taxa · Hashing consistente
Toda a documentação de desenvolvimento
Comunidade
ProjetosDescubra criadores e trabalhosRegistros de desenvolvimentoDecisões e aprendizadosPromptsInstruções reutilizáveisProblemas de ferramentas de IAProblemas e contornos de Claude, Codex, GeminiVitrineResultados concluídosGuia da comunidadeComo construímos em aberto
Colabore
Transferência técnicaApps nativos em Rust e eguiConstrução de site10 idiomas, contas, documentação e downloadsConstrução de app de desktopRust e egui, sem WebViewPipeline de lançamento e pagamentoAssinatura, MSI, deb, rpm, AppImage, hashesParceiro de vendasRecomende e ganhe 30%ContatoDesenvolvimento, parcerias e investimento
Serviços
Área de trabalho remotaAcesse seu computador pelo navegadorPacotes de instalação sob medidaSó o necessário, configurações pré-carregadas
Comprar
PT
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Entrar
Entrar
TASTEDEV

De pequenas ferramentas a um desenvolvimento melhor.

support@tastedev.netApoiar TASTEDEV
ProdutosLinha de produtosComprarDocsDownloadsMarketplaceSuporte
ComunidadeProjetosRegistros de desenvolvimentoPromptsProblemas de ferramentas de IAVitrine
PolíticasSobre nósPolítica de privacidadeTermos de usoTermos de assinaturaReembolsoDiretrizes da comunidade
ContaEntrarCriar conta
Visitantes
Hoje
Ontem
Visualizações totais
Empresa
GXSOFT
Representante
CHOI YOUNG GU
Número de registro comercial
853-44-00368
Endereço
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefone
+82-10-4404-1523
E-mail
whitecalvin@tastedev.net
Responsável pela privacidade
CHOI YOUNG GU

© 2026 TASTEDEVAs informações dos produtos se baseiam em fontes de desenvolvimento verificadas.Lançado · em melhoria

Documentação de Dart
Dart
Getting Started with DartSyntax BasicsTypes and DataLibraries and PackagesErrors and TestingKey Concepts
Discussões

Guia de Dart · 4/6

Libraries and Packages

Por enquanto, este capítulo está disponível apenas em inglês.

Dart code is organized into two units: libraries and packages. A library groups code and defines what is visible, while a package distributes libraries together with configuration and dependencies. This chapter covers import and export, the pub package manager and pubspec.yaml, the standard package layout, and publishing to pub.dev.

Libraries and imports

In Dart, every file is a library. Top-level declarations and members whose names start with an underscore (_) are visible only inside that library, so there is no private keyword. To use another library, bring it in with import.

FormExampleMeaning
dart:import 'dart:math';A core library that ships with the SDK
package:import 'package:http/http.dart';A dependency, or your own package's lib
Relative pathimport 'src/parser.dart';Another file in the same package
import 'dart:math';
import 'dart:convert' show jsonDecode, jsonEncode; // only these names
import 'package:path/path.dart' as p;              // a prefix avoids name clashes
import 'src/internal.dart' hide debugHelper;       // everything except one name

void main() {
  print(sqrt(16));                                  // dart:math
  print(jsonEncode({'ok': true}));                  // dart:convert
  print(p.join('assets', 'images', 'logo.png'));    // package:path
}

show imports only the listed names and hide everything except them. An as prefix prevents name clashes. On the web, deferred as loads a library lazily.

Collecting the public API with export

A package usually keeps its implementation under lib/src and exports only the public parts from a main file directly under lib. Users then need to import just that one file.

// lib/shapes.dart: the package's main library
library;

export 'src/circle.dart';
export 'src/square.dart' show Square;
// src/geometry_utils.dart is not exported, so it stays an implementation detail

By convention, files in lib/src are private implementation. Other packages can technically import package:shapes/src/..., but it is discouraged and the analyzer warns about it.

pub and pubspec.yaml

pub is Dart's package manager, and is the public package repository. A package's name, version, supported SDK range and dependencies live in at the project root.

Dúvidas sobre este capítulo?
Capítulo anteriorTypes and DataPróximo capítuloErrors and Testing
pub.dev
pubspec.yaml
name: weather_cli
description: An example tool that shows the weather on the command line.
version: 1.0.0
publish_to: none   # prevents accidental publishing to pub.dev

environment:
  sdk: ^3.5.0      # dart create fills this in for your current SDK

dependencies:
  http: ^1.2.0
  path: ^1.9.0

dev_dependencies:
  lints: ^5.0.0
  test: ^1.25.0

A caret (^) allows newer versions up to the next major one: ^1.2.0 means at least 1.2.0 and below 2.0.0. dependencies are needed at run time; dev_dependencies only during development. The versions above are examples; the commands below fill in the latest compatible ones.

dart pub commands

dart pub add http             # add to dependencies
dart pub add --dev test       # add to dev_dependencies
dart pub remove http          # remove a dependency
dart pub get                  # fetch what pubspec.yaml asks for
dart pub upgrade              # upgrade to the newest allowed versions
dart pub outdated             # list dependencies with newer versions
dart pub deps                 # print the dependency tree

dart pub get records the chosen versions in pubspec.lock. Commit it for apps and executables so everyone and CI use the same versions; for libraries, consumers resolve versions again, so it matters less. Packages are stored in a shared pub cache.

You can also depend on packages from a Git repository or a local path.

dependencies:
  my_utils:
    path: ../my_utils
  shared_models:
    git:
      url: https://github.com/example/shared_models.git
      ref: main

Package layout

The pub tool and pub.dev expect a conventional directory layout.

PathContents
lib/Library code exposed to other packages
lib/src/Implementation details (private by convention)
bin/Entry points run with dart run
test/Tests (file names end in _test.dart)
example/Usage examples (shown on the pub.dev Example tab)
tool/Development scripts such as build or release helpers
README.md, CHANGELOG.md, LICENSEIntroduction, change history, license

Files outside lib (in bin, test and so on) import their own package's libraries with the package: form, for example import 'package:weather_cli/weather_cli.dart';.

Publishing to pub.dev

For a public package, remove publish_to: none and provide a description, a repository or homepage, a LICENSE, a README.md and a CHANGELOG.md. Always run a dry run before publishing.

dart pub publish --dry-run    # check for problems without uploading
dart pub publish              # authenticate with a Google account and publish

Published versions cannot be deleted, and the same version number cannot be uploaded twice. A mistaken version can be retracted for a short period after publishing, but the usual fix is to publish a corrected new version. Follow semantic versioning and bump the major version for breaking changes. pub.dev scores packages on documentation, static analysis and platform support, so checking with dart analyze and dart doc beforehand pays off.

Summary

In Dart, each file is a library and names starting with _ stay hidden outside it. Control what you import with show, hide and as, and gather the public API in a main file with export. Declare dependencies in pubspec.yaml, manage them with dart pub add, get and upgrade, follow the standard layout, and publish to pub.dev with dart pub publish.

0 comentários

Principais comentáriosMais recentes primeiro

Fazer login · Faça login para deixar um comentário.