Akışlar ve Tepkisel Veriler
Canlı güncellemeler, yuvalar ve tepkisel kullanıcı arayüzü gibi sürekli eşzamansız verileri işlemek için Flutter'da Dart Akışlarıyla çalışmayı öğrenin.
Akışlar ve Tepkisel Veriler, CoddyKit'te ücretsiz bir Flutter Mobile Development dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Flutter Mobile Development öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Flutter Mobile Development kursu toplamda 4 dersten oluşur.
Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.
Beyond a Single Future
A Future gives you one value later. A Stream gives you many values over time.
- WebSocket messages
- Sensor readings
- Live database updates
Streams are the reactive backbone of async Dart.
Listening to a Stream
Subscribe to a stream with listen, supplying callbacks for data, errors and completion.
stream.listen(
(data) => print('Got: ' + data.toString()),
onError: (e) => print('Error: ' + e.toString()),
onDone: () => print('Done'),
);Creating Streams with async*
An async generator uses async* and yield to emit values.
Stream<int> countTo(int n) async* {
for (var i = 1; i <= n; i++) {
await Future.delayed(const Duration(seconds: 1));
yield i;
}
}await for
Inside an async function you can iterate a stream with await for, processing each value as it arrives.
Future<void> run() async {
await for (final value in countTo(3)) {
print(value);
}
}Single vs Broadcast
A single-subscription stream allows one listener. A broadcast stream allows many. Convert with asBroadcastStream().
final broadcast = controller.stream.asBroadcastStream();
broadcast.listen((v) => print('A: ' + v.toString()));
broadcast.listen((v) => print('B: ' + v.toString()));StreamController
A StreamController lets you push values into a stream from your own code.
final controller = StreamController<String>();
controller.add('hello');
controller.add('world');
controller.close();Transforming Streams
Streams have functional operators like map, where and take.
stream
.where((n) => n.isEven)
.map((n) => n * 10)
.take(5)
.listen(print);StreamBuilder Widget
In the UI, StreamBuilder rebuilds whenever the stream emits a new value.
StreamBuilder<int>(
stream: countTo(5),
builder: (context, snapshot) {
if (!snapshot.hasData) return const CircularProgressIndicator();
return Text('Value: ' + snapshot.data.toString());
},
);Reading the Snapshot
The AsyncSnapshot tells you the connection state and whether data or an error is present.
snapshot.connectionStatesnapshot.hasData/snapshot.datasnapshot.hasError/snapshot.error
if (snapshot.hasError) return Text('Error: ' + snapshot.error.toString());Cancelling Subscriptions
Always cancel subscriptions in dispose to avoid memory leaks.
late StreamSubscription sub;
@override
void dispose() {
sub.cancel();
super.dispose();
}Backpressure & Errors
Streams can emit errors mid-flow. Handle them with handleError so one bad event does not kill the whole pipeline.
stream
.handleError((e) => print('Skipped: ' + e.toString()))
.listen(print);Quick Check
Which widget rebuilds your UI automatically as a stream emits new values?
Recap
You learned to work with Streams:
- async* / yield and StreamController to create them
- map / where / take to transform
- StreamBuilder to drive reactive UI
- Cancelling subscriptions and handling errors
Streams let your app react to continuous async data in real time.
Sıkça Sorulan Sorular
“Akışlar ve Tepkisel Veriler” dersi ücretsiz mi?
Evet — “Akışlar ve Tepkisel Veriler” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Flutter Mobile Development kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Flutter Mobile Development kursu toplamda 4 dersten oluşur.
“Akışlar ve Tepkisel Veriler” dersinde ne öğreneceğim?
Canlı güncellemeler, yuvalar ve tepkisel kullanıcı arayüzü gibi sürekli eşzamansız verileri işlemek için Flutter'da Dart Akışlarıyla çalışmayı öğrenin. Flutter Mobile Development ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.
Flutter Mobile Development öğrenmeye başlamak için deneyim gerekli mi?
Önceden deneyim gerekmez. CoddyKit'te Flutter Mobile Development, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.
“Akışlar ve Tepkisel Veriler” dersi ne kadar sürer?
Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.
Bu Flutter Mobile Development dersinde kod yazıp çalıştırabilir miyim?
Evet. Her Flutter Mobile Development dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.
Bu kursun tüm dersleri
- Future'lar ve Async/Await
- HTTP İstekleri ve JSON
- Async İçinde Hata İşleme
- Akışlar ve Tepkisel Veriler