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 Flutter
Flutter
Getting Started with FlutterProject StructureCore ConceptsData and StateTestingBuilding and Deployment
Discussioni

Guida a Flutter · 4/6

Data and State

Per ora questo capitolo è disponibile solo in inglese.

As an app grows, the key questions are where data lives and which widgets rebuild when it changes. This chapter covers local and shared state, async code, networking and storage.

Local state: setState

State used by one widget, such as a selected tab, fits in a StatefulWidget with setState. Keep it in the nearest common parent of the widgets that need it and pass values and callbacks down (lifting state up).

class TodoPage extends StatefulWidget {
  const TodoPage({super.key});

  @override
  State<TodoPage> createState() => _TodoPageState();
}

class _TodoPageState extends State<TodoPage> {
  final List<String> _items = [];

  void _add(String text) => setState(() => _items.add(text));

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        TodoInput(onSubmit: _add),
        Expanded(child: TodoList(items: _items)),
      ],
    );
  }
}

Shared state: InheritedWidget

InheritedWidget lets any descendant look a value up without passing it through every constructor; Theme.of(context) works this way.

class UserScope extends InheritedWidget {
  const UserScope({super.key, required this.userName, required super.child});

  final String userName;

  static UserScope of(BuildContext context) {
    return context.dependOnInheritedWidgetOfExactType<UserScope>()!;
  }

  @override
  bool updateShouldNotify(UserScope oldWidget) => userName != oldWidget.userName;
}

// Anywhere below it
final name = UserScope.of(context).userName;

Widgets that read it this way rebuild when updateShouldNotify returns true. Using it directly is verbose, so most apps use a package built on it.

Provider and Riverpod

Provider wraps InheritedWidget in an easier API and is used in the state management examples of the official docs. Model state with a ChangeNotifier; after changing data, call notifyListeners() and the widgets watching it rebuild.

// flutter pub add provider
class CartModel extends ChangeNotifier {
  final List<String> _items = [];
  List<String> get items => List.unmodifiable(_items);

  void add(String item) {
    _items.add(item);
    notifyListeners();
  }
}

void main() {
  runApp(
    ChangeNotifierProvider(
      create: (context) => CartModel(),
      child: const MyApp(),
    ),
  );
}

// Read and listen (rebuilds on change)
final count = context.watch<CartModel>().items.length;
// Call a method without listening
context.read<CartModel>().add('Apple');

Riverpod is a separate package by the author of Provider. Providers are global declarations outside the widget tree, read through ref instead of BuildContext, with compile-time safety, built-in async support and easy test overrides. Wrap the app root in .

Domande su questo capitolo?
Capitolo precedenteCore ConceptsCapitolo successivoTesting
ProviderScope
// flutter pub add flutter_riverpod
class CounterNotifier extends Notifier<int> {
  @override
  int build() => 0;

  void increment() => state++;
}

final counterProvider = NotifierProvider<CounterNotifier, int>(CounterNotifier.new);

class CounterText extends ConsumerWidget {
  const CounterText({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    final count = ref.watch(counterProvider);
    return TextButton(
      onPressed: () => ref.read(counterProvider.notifier).increment(),
      child: Text('$count'),
    );
  }
}

Bloc and others are also popular; all keep state out of the UI and rebuild only what changed.

Async: Future and Stream

A Future delivers one value later (a network response); a Stream delivers many values over time (chat messages). Write async code with async and await, and show results with FutureBuilder and StreamBuilder.

Networking with the http package

import 'dart:convert';
import 'package:http/http.dart' as http;

class Post {
  const Post({required this.id, required this.title});
  final int id;
  final String title;

  factory Post.fromJson(Map<String, dynamic> json) =>
      Post(id: json['id'] as int, title: json['title'] as String);
}

Future<Post> fetchPost(int id) async {
  final response = await http.get(Uri.parse('https://jsonplaceholder.typicode.com/posts/$id'));
  if (response.statusCode != 200) {
    throw Exception('Request failed: ${response.statusCode}');
  }
  return Post.fromJson(jsonDecode(response.body) as Map<String, dynamic>);
}

Create the Future once as a State field (assign it in initState or declare it late final as below), never inside build, or every rebuild repeats the request.

late final Future<Post> _post = fetchPost(1);

@override
Widget build(BuildContext context) {
  return FutureBuilder<Post>(
    future: _post,
    builder: (context, snapshot) {
      if (snapshot.hasError) return Text('Error: ${snapshot.error}');
      if (!snapshot.hasData) return const CircularProgressIndicator();
      return Text(snapshot.data!.title);
    },
  );
}

Release Android builds need the internet permission in android/app/src/main/AndroidManifest.xml (debug builds include it by default), and macOS apps need the network client entitlement.

On-device storage

NeedPackage
Small key-value settingsshared_preferences
Document and cache paths for filespath_provider
Relational data (SQLite)sqflite, drift
Secrets such as tokensflutter_secure_storage
import 'package:shared_preferences/shared_preferences.dart';

final prefs = SharedPreferencesAsync();

Future<void> saveTheme(bool dark) => prefs.setBool('darkMode', dark);
Future<bool> loadTheme() async => await prefs.getBool('darkMode') ?? false;

Summary

  • Use setState for state inside one widget; for shared state, use packages built on InheritedWidget such as Provider, or Riverpod.
  • Handle async values with Future (one value) and Stream (many), shown via FutureBuilder and StreamBuilder.
  • Use http for network calls and shared_preferences or sqflite for local storage.

0 commenti

Commenti principaliPrima i più recenti

Accedi · Accedi per lasciare un commento.