dio #
A powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout etc.
Get started #
| 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(); | |
| 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(){ | |
| var a = B(); | |
| switch(a.runtimeType){ | |
| case A:{ | |
| print ("A"); | |
| break; | |
| } | |
| case B:{ | |
| print ("B"); | |
| break; |
| 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 { |
| void main() async { | |
| print(people); | |
| print("Changing color to light Blue"); | |
| colors[1] = 'Light Blue'; | |
| print(people); | |
| } | |
| class Person{ | |
| String name; | |
| int colorIndex; |
| void main() { | |
| Function func; | |
| func = () { | |
| func2(); | |
| }; | |
| print(func()); | |
| func = () => func2(); | |
| import 'package:flutter/material.dart'; | |
| | |
| final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
| | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| | |
| class MyApp extends StatelessWidget { | |
| @override |
| // don't forget to add `BlocSupervisor.delegate = SimpleBlocDelegate();` to the beginning of your main.dart file. | |
| import 'package:flutter/foundation.dart'; | |
| import 'package:flutter_bloc/flutter_bloc.dart'; | |
| class SimpleBlocDelegate extends BlocDelegate { | |
| SimpleBlocDelegate() { | |
| debugPrint( | |
| '[INFO] Initializing SimpleBlocDelegate. Logging all Bloc events to the console'); |
The names of the TextTheme properties match this table from the /// Material Design spec /// with two exceptions: the styles called H1-H6 in the spec are /// headline1-headline6 in the API, and body1,body2 are called /// bodyText1 and bodyText2.
NAME SIZE WEIGHT SPACING 2018 NAME /// display4 112.0 thin 0.0 headline1 /// display3 56.0 normal 0.0 headline2 /// display2 45.0 normal 0.0 headline3