Last active
May 7, 2022 22:01
-
-
Save Maistho/b22671df77b681e72f6ec8b3d193c42c to your computer and use it in GitHub Desktop.
Crash reproduction for flutter bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( | |
title: 'Flutter Demo', | |
home: MyHomePage(), | |
); | |
} | |
} | |
class MyHomePage extends StatelessWidget { | |
const MyHomePage({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: const Text('It will crash after 5 seconds')), | |
body: CustomScrollView( | |
slivers: [ | |
FutureBuilder<String>( | |
future: Future.delayed(const Duration(seconds: 5), () => "Crash"), | |
builder: (context, snapshot) { | |
if (!snapshot.hasData) { | |
return const SliverToBoxAdapter( | |
child: SizedBox(), | |
); | |
} | |
return SliverList( | |
delegate: SliverChildListDelegate.fixed([ | |
Text(snapshot.data!), | |
]), | |
); | |
}, | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment