dio #
A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout etc.
Get started #
| void main() { | |
| Function func; | |
| func = () { | |
| func2(); | |
| }; | |
| print(func()); | |
| func = () => func2(); | |
| void main() async { | |
| print(people); | |
| print("Changing color to light Blue"); | |
| colors[1] = 'Light Blue'; | |
| print(people); | |
| } | |
| class Person{ | |
| String name; | |
| int colorIndex; |
| import 'dart:convert'; | |
| import 'dart:io'; | |
| import 'package:meta/meta.dart'; | |
| import 'package:pub_semver/pub_semver.dart'; | |
| import 'package:pubspec/pubspec.dart'; | |
| import 'functions.dart'; | |
| main(List<String> arguments) async { |
| main(){ | |
| var a = B(); | |
| switch(a.runtimeType){ | |
| case A:{ | |
| print ("A"); | |
| break; | |
| } | |
| case B:{ | |
| print ("B"); | |
| break; |
| class ColoredTabBar extends Container implements PreferredSizeWidget { | |
| ColoredTabBar({@required this.color, this.tabBar, this.header}); | |
| final Color color; | |
| final TabBar tabBar; | |
| final Widget header; | |
| @override | |
| Size get preferredSize => | |
| tabBar?.preferredSize ?? Size(double.infinity, 48.0); |
| main(){ | |
| List<SalesItem> salesList = List.generate(10, (int i) => SalesItem(i)); | |
| print("salesList = $salesList"); | |
| // the map function takes one thing and converts it to another. You can use it to take an object, | |
| // perform an operation and return the modified object. The function below unwraps the price so that | |
| // I have a list of ints only. (Since you technically can't "add" [SalesItem]s. | |
| List<int> listOfOnlyPrices = | |
| salesList.map<int>((SalesItem item) => item.price).toList(); | |
| void main() async { | |
| await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); | |
| runApp(MyApp()); | |
| … | |
| } |
| FAILURE: Build failed with an exception. | |
| * What went wrong: | |
| Could not resolve all files for configuration ':app:debugRuntimeClasspath'. | |
| > Could not find com.google.android.exoplayer:exoplayer-hls:2.9.1. | |
| Searched in the following locations: | |
| - file:/Users/thinkdigital/Library/Android/sdk/extras/m2repository/com/google/android/exoplayer/exoplayer-hls/2.9.1/exoplayer-hls-2.9.1.pom | |
| - file:/Users/thinkdigital/Library/Android/sdk/extras/m2repository/com/google/android/exoplayer/exoplayer-hls/2.9.1/exoplayer-hls-2.9.1.jar | |
| - file:/Users/thinkdigital/Library/Android/sdk/extras/google/m2repository/com/google/android/exoplayer/exoplayer-hls/2.9.1/exoplayer-hls-2.9.1.pom | |
| - file:/Users/thinkdigital/Library/Android/sdk/extras/google/m2repository/com/google/android/exoplayer/exoplayer-hls/2.9.1/exoplayer-hls-2.9.1.jar |
| Card( | |
| color: backgroundColor, | |
| margin: EdgeInsets.symmetric(vertical: 10, horizontal: 5), | |
| child: Padding( | |
| padding: const EdgeInsets.only( | |
| left: 15, | |
| right: 5, | |
| top: 8, | |
| bottom: 8), //symmetric(vertical: 8.0, horizontal: 15), | |
| child: new Row( |