Aller au contenu principal
ProduitsOutils de bureauTASTECADConsultation de plansTASTEFILESGestion de fichiersTASTEFTPTransfert de fichiersTASTESSHEspace de travail à distanceTASTEZIPCompression et extractionTASTEWINMGestion de fichiersOutils pour développeursTASTECODEEnvironnement de développement intégré pour RustTASTESTUDIOEnvironnement intégré de développement et de testTASTEETLIntégration de données (ETL)ServeursTASTEREMOTEServeur de bureau à distanceTASTEGEOServeur géospatialTASTEMAILEspace de travail e-mailInvestissementTASTESTOCKApplication de bureau de trading automatique d'actionsCommencerTéléchargementsDocumentationAcheterTous les produits
Marketplace
Actualités
TechActualitésL’actu dev du jourDocs développeursLangages de programmationRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFrameworks front-end webNext.jsReactVue.js · NuxtSvelteKitAngularFrameworks serveurSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFrameworks d'applications et de bureauTauriFlutterReact NativeElectronAlgorithmesBases des algorithmesAlgorithmes essentielsAlgorithmes avancésAlgorithmes pratiques
CommunautéProjetsJournaux de développementPromptsProblèmes d’outils d’IAVitrineGuide de la communauté
CollaborerTransfert techniqueRéalisation de site webRéalisation d'application de bureauChaîne de publication et de paiementPartenaire commercialContact
ServicesBureau à distancePaquets d'installation sur mesure
TASTEDEV
Produits

Outils de bureau

TASTECADDes plans complexes, ouverts en toute légèretéTASTEFILESSeulement les fichiers utiles, au plus viteTASTEFTPLe chemin le plus net pour vos fichiersTASTESSHEntre vos serveurs et vous, un lien plus solideTASTEZIPCompresser plus vite, extraire en toute sécuritéTASTEWINMUn gestionnaire de fichiers à deux volets, pensé pour le clavier

Outils pour développeurs

TASTECODEModifier, compiler, déboguer et tester vos apps Rust dans une seule fenêtreTASTESTUDIODe l’édition aux tests à distance et aux corrections IA approuvéesTASTEETLDéplacer les données, les valeurs sous les yeux

Serveurs

TASTEREMOTEUn bureau à distance hébergé sur votre propre serveurTASTEGEOUn serveur géospatial compatible GeoServer, reconstruit en RustTASTEMAILReprenez la maîtrise de vos e-mails

Investissement

TASTESTOCKDu trading automatique d'actions selon vos règles : quand, et quoi

Commencer

TéléchargementsDernières versions de chaque produitDocsUtiliser chaque produitAcheterAbonnements et licences perpétuellesTous les produitsTous les produits en un coup d’œil
Tous les produits
MarketplaceActualités
Tech

Actualités

L’actu dev du jourAnnonces officielles : langages, frameworks, GitHub et IADocs développeursGuides des langages, frameworks et algorithmes

Langages de programmation

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Frameworks

Frameworks front-end webNext.jsReactVue.js · NuxtSvelteKitAngular
Frameworks serveurSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Frameworks d'applications et de bureauTauriFlutterReact NativeElectron

Algorithmes

Bases des algorithmesAnalyse de complexité · Tri · Recherche · Structures de données de base · Arbres et tasAlgorithmes essentielsParcours de graphe · Plus courts chemins et arbres couvrants · Programmation dynamique · Algorithmes gloutons · Diviser pour régner · Backtracking (retour sur trace)Algorithmes avancésAlgorithmes sur les chaînes · Mathématiques et théorie des nombres · Manipulation de bits · Arbres de segments · Union-FindAlgorithmes pratiquesStratégie pour les entretiens de codage · Cache LRU · Limitation de débit · Hachage cohérent
Toute la documentation de développement
Communauté
ProjetsDécouvrir les créateurs et leurs travauxJournaux de développementDécisions et enseignementsPromptsInstructions réutilisablesProblèmes d’outils d’IAProblèmes et contournements de Claude, Codex, GeminiVitrineRéalisations terminéesGuide de la communautéConstruire en toute transparence
Collaborer
Transfert techniqueApplications natives en Rust et eguiRéalisation de site web10 langues, comptes, documentation et téléchargementsRéalisation d'application de bureauRust et egui, sans WebViewChaîne de publication et de paiementSignature, MSI, deb, rpm, AppImage, empreintesPartenaire commercialRecommandez-nous, touchez 30 %ContactDéveloppement, partenariats, investissement
Services
Bureau à distanceAccédez à votre ordinateur depuis le navigateurPaquets d'installation sur mesureSeulement l'utile, réglages préchargés
Acheter
FR
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Se connecter
Se connecter
TASTEDEV

Des petits outils à un meilleur développement.

support@tastedev.netSoutenir TASTEDEV
ProduitsGamme de produitsAcheterDocsTéléchargementsMarketplaceAssistance
CommunautéProjetsJournaux de développementPromptsProblèmes d’outils d’IAVitrine
RèglesÀ proposPolitique de confidentialitéConditions d'utilisationConditions d’abonnementRemboursementRègles de la communauté
CompteSe connecterS'inscrire
Visiteurs
Aujourd’hui
Hier
Vues au total
Société
GXSOFT
Représentant
CHOI YOUNG GU
Numéro d’enregistrement
853-44-00368
Adresse
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Téléphone
+82-10-4404-1523
E-mail
whitecalvin@tastedev.net
Responsable de la confidentialité
CHOI YOUNG GU

© 2026 TASTEDEVLes informations produit s'appuient sur des sources de développement vérifiées.Publié · en amélioration

Documentation Dart
Dart
Getting Started with DartSyntax BasicsTypes and DataLibraries and PackagesErrors and TestingKey Concepts
Discussions

Guide Dart · 4/6

Libraries and Packages

Ce chapitre n'est disponible qu'en anglais pour le moment.

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.

Des questions sur ce chapitre ?
Chapitre précédentTypes and DataChapitre suivantErrors 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 commentaire

Meilleurs commentairesPlus récents d'abord

Se connecter · Connectez-vous pour laisser un commentaire.