@@ -2,34 +2,31 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [FutureBuilder].
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [FutureBuilder].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const FutureBuilderExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class FutureBuilderExampleApp extends StatelessWidget {
|
||||
const FutureBuilderExampleApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
title: _title,
|
||||
home: MyStatefulWidget(),
|
||||
home: FutureBuilderExample(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
const MyStatefulWidget({super.key});
|
||||
class FutureBuilderExample extends StatefulWidget {
|
||||
const FutureBuilderExample({super.key});
|
||||
|
||||
@override
|
||||
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
|
||||
State<FutureBuilderExample> createState() => _FutureBuilderExampleState();
|
||||
}
|
||||
|
||||
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
class _FutureBuilderExampleState extends State<FutureBuilderExample> {
|
||||
final Future<String> _calculation = Future<String>.delayed(
|
||||
const Duration(seconds: 2),
|
||||
() => 'Data Loaded',
|
||||
|
||||
@@ -2,36 +2,33 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flutter code sample for [StreamBuilder].
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
void main() => runApp(const MyApp());
|
||||
/// Flutter code sample for [StreamBuilder].
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
void main() => runApp(const StreamBuilderExampleApp());
|
||||
|
||||
static const String _title = 'Flutter Code Sample';
|
||||
class StreamBuilderExampleApp extends StatelessWidget {
|
||||
const StreamBuilderExampleApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const MaterialApp(
|
||||
title: _title,
|
||||
home: MyStatefulWidget(),
|
||||
home: StreamBuilderExample(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MyStatefulWidget extends StatefulWidget {
|
||||
const MyStatefulWidget({super.key});
|
||||
class StreamBuilderExample extends StatefulWidget {
|
||||
const StreamBuilderExample({super.key});
|
||||
|
||||
@override
|
||||
State<MyStatefulWidget> createState() => _MyStatefulWidgetState();
|
||||
State<StreamBuilderExample> createState() => _StreamBuilderExampleState();
|
||||
}
|
||||
|
||||
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
|
||||
class _StreamBuilderExampleState extends State<StreamBuilderExample> {
|
||||
final Stream<int> _bids = (() {
|
||||
late final StreamController<int> controller;
|
||||
controller = StreamController<int>(
|
||||
|
||||
Reference in New Issue
Block a user