This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 16: Test Driver | |
//****************************************************************************** | |
import 'package:flutter_driver/driver_extension.dart'; | |
import 'package:counter_app/main.dart' as app; | |
void main() { | |
enableFlutterDriverExtension(); |
This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 16: Test Driver | |
//****************************************************************************** | |
import 'package:flutter_driver/flutter_driver.dart'; | |
import 'package:test/test.dart'; | |
void main() { | |
group("Counter app test", () { | |
final counterText = find.byValueKey("counter"); |
This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 17: HTTP Requests | |
//****************************************************************************** | |
void main() => runApp(DemoApp()); | |
class DemoApp extends StatelessWidget { | |
final req = const RequestItem( | |
url: "https://jsonplaceholder.typicode.com/posts/10" | |
); |
This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 17: HTTP Requests | |
//****************************************************************************** | |
class Item { | |
final int id; | |
final String title; | |
Item({ | |
required this.id, | |
required this.title |
This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 17: HTTP Requests | |
//****************************************************************************** | |
abstract class HTTPRequest<T> { | |
Future<T> execute(); | |
} |
This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 17: HTTP Requests | |
//****************************************************************************** | |
class RequestItem implements HTTPRequest<Item> { | |
final String url; | |
const RequestItem({ required this.url }); | |
Future<Item> execute() async { |
This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 17: HTTP Requests | |
//****************************************************************************** | |
class HTTPWidget extends StatefulWidget { | |
final HTTPRequest<Item> _request; | |
const HTTPWidget(this._request); | |
@override |
This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 17: HTTP Requests | |
//****************************************************************************** | |
class SuccessItemWidget extends StatelessWidget { | |
final Item? data; | |
const SuccessItemWidget(this.data); | |
@override | |
Widget build(BuildContext context) { |
This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 17: HTTP Requests | |
//****************************************************************************** | |
class ErrorItemWidget extends StatelessWidget { | |
const ErrorItemWidget(); | |
@override | |
Widget build(BuildContext context) { |
This file contains 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
//this code belongs to https://fluttercompletereference.com/ | |
//Chapter 17: Files Download | |
//****************************************************************************** | |
void main() => runApp(DemoApp()); | |
class DemoApp extends StatelessWidget { | |
const DemoApp(); | |
@override |
OlderNewer