Vai al contenuto principale
ProdottiStrumenti desktopTASTECADVisualizzazione disegniTASTEFILESGestione fileTASTEFTPTrasferimento fileTASTESSHSpazio di lavoro remotoTASTEZIPCompressione ed estrazioneTASTEWINMGestione fileStrumenti per sviluppatoriTASTECODEAmbiente di sviluppo integrato per RustTASTESTUDIOAmbiente integrato di sviluppo e testTASTEETLIntegrazione dati (ETL)ServerTASTEREMOTEServer di desktop remotoTASTEGEOServer geospazialeTASTEMAILSpazio di lavoro emailInvestimentiTASTESTOCKApp desktop di trading automatico azionarioIniziaDownloadDocumentazioneAcquistaTutti i prodotti
Marketplace
Notizie
TecnologiaNotizieNotizie di sviluppo di oggiDocumentazioneLinguaggi di programmazioneRustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDartFramework frontend webNext.jsReactVue.js · NuxtSvelteKitAngularFramework serverSpring BootDjangoFastAPIASP.NET CoreNestJS · ExpressFramework per app e desktopTauriFlutterReact NativeElectronAlgoritmiBasi degli algoritmiAlgoritmi fondamentaliAlgoritmi avanzatiAlgoritmi pratici
CommunityProgettiLog di sviluppoPromptProblemi degli strumenti di IAVetrinaGuida alla community
CollaboraTrasferimento tecnicoRealizzazione del sito webRealizzazione di app desktopPipeline di rilascio e pagamentoPartner commercialeContatti
ServiziDesktop remotoPacchetti di installazione su misura
TASTEDEV
Prodotti

Strumenti desktop

TASTECADApri con leggerezza anche i disegni più complessiTASTEFILESSolo i file che servono, alla massima velocitàTASTEFTPLa via più ordinata per i tuoi fileTASTESSHUn legame più solido tra te e i tuoi serverTASTEZIPComprimi più veloce, estrai più sicuroTASTEWINMUn file manager a due pannelli pensato per la tastiera

Strumenti per sviluppatori

TASTECODEModifica, compila, esegui il debug e testa app Rust in un'unica finestraTASTESTUDIODalla modifica ai test remoti e alle correzioni IA approvateTASTEETLSposta i dati guardando i valori

Server

TASTEREMOTEUn desktop remoto che gira sul tuo serverTASTEGEOUn server geospaziale compatibile con GeoServer, ricostruito in RustTASTEMAILRiprendi il controllo della tua posta

Investimenti

TASTESTOCKTrading automatico azionario secondo le regole che decidi tu: quando e che cosa

Inizia

DownloadUltime versioni di ogni prodottoDocsCome usare ogni prodottoAcquistaAbbonamenti e licenze perpetueTutti i prodottiTutti i prodotti a colpo d’occhio
Tutti i prodotti
MarketplaceNotizie
Tecnologia

Notizie

Notizie di sviluppo di oggiAnnunci ufficiali su linguaggi, framework, GitHub e IADocumentazioneGuide a linguaggi, framework e algoritmi

Linguaggi di programmazione

RustTypeScriptJavaScriptPythonGoC#JavaCC++KotlinDart

Framework

Framework frontend webNext.jsReactVue.js · NuxtSvelteKitAngular
Framework serverSpring BootDjangoFastAPIASP.NET CoreNestJS · Express
Framework per app e desktopTauriFlutterReact NativeElectron

Algoritmi

Basi degli algoritmiAnalisi della complessità · Ordinamento · Ricerca · Strutture dati di base · Alberi e heapAlgoritmi fondamentaliVisita dei grafi · Cammini minimi e alberi ricoprenti · Programmazione dinamica · Algoritmi greedy · Divide et impera · BacktrackingAlgoritmi avanzatiAlgoritmi sulle stringhe · Matematica e teoria dei numeri · Manipolazione dei bit · Alberi di segmenti · Union-FindAlgoritmi praticiStrategia per colloqui di programmazione · Cache LRU · Rate limiting · Hashing consistente
Tutta la documentazione di sviluppo
Community
ProgettiScopri sviluppatori e lavoriLog di sviluppoDecisioni e lezioni appresePromptIstruzioni riutilizzabiliProblemi degli strumenti di IAProblemi e alternative di Claude, Codex, GeminiVetrinaRisultati completatiGuida alla communityCome sviluppiamo in modo aperto
Collabora
Trasferimento tecnicoApp native in Rust ed eguiRealizzazione del sito web10 lingue, account, documentazione e downloadRealizzazione di app desktopRust ed egui, senza WebViewPipeline di rilascio e pagamentoFirma, MSI, deb, rpm, AppImage, hashPartner commercialeConsigliaci e ricevi il 30%ContattiSviluppo, partnership e investimenti
Servizi
Desktop remotoRaggiungi il tuo computer dal browserPacchetti di installazione su misuraSolo il necessario, impostazioni precaricate
Acquista
IT
한국어EnglishDeutschEspañolFrançaisItalianoPortuguês (Brasil)日本語简体中文繁體中文
Accedi
Accedi
TASTEDEV

Dai piccoli strumenti a uno sviluppo migliore.

support@tastedev.netSostieni TASTEDEV
ProdottiGamma di prodottiAcquistaDocsDownloadMarketplaceAssistenza
CommunityProgettiLog di sviluppoPromptProblemi degli strumenti di IAVetrina
NormeChi siamoInformativa sulla privacyTermini di servizioCondizioni di abbonamentoRimborsiLinee guida della community
AccountAccediRegistrati
Visitatori
Oggi
Ieri
Visualizzazioni totali
Società
GXSOFT
Rappresentante
CHOI YOUNG GU
Numero di registrazione
853-44-00368
Indirizzo
9F V24, 351 Gyeongin-ro, Michuhol-gu, Incheon, Republic of Korea
Telefono
+82-10-4404-1523
E-mail
whitecalvin@tastedev.net
Responsabile privacy
CHOI YOUNG GU

© 2026 TASTEDEVLe informazioni sui prodotti si basano su fonti di sviluppo verificate.Rilasciato · in miglioramento

Documentazione di Dart
Dart
Getting Started with DartSyntax BasicsTypes and DataLibraries and PackagesErrors and TestingKey Concepts
Discussioni

Guida a Dart · 4/6

Libraries and Packages

Per ora questo capitolo è disponibile solo in inglese.

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.

Domande su questo capitolo?
Capitolo precedenteTypes and DataCapitolo successivoErrors 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 commenti

Commenti principaliPrima i più recenti

Accedi · Accedi per lasciare un commento.