View main.dart
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
void main() { | |
var deck = Deck(); | |
//deck.shuffle(); | |
// print(deck.cardsWithSuit('Clubs')); | |
// print(deck); | |
// print(deck.deal(4)); | |
// print(deck); | |
print(deck); | |
deck.removeCard('Diamonds','Ace'); | |
print(deck); |
View main.dart
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
void main() { | |
var listEx = <int>[]; | |
listEx.add(341); | |
listEx.add(1); | |
listEx.add(23); | |
// iterating across list listEx | |
for (int element in listEx) { | |
print(element); | |
} |
View main.dart
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
import 'dart:convert'; | |
import 'package:http/http.dart' show get; | |
void main() async { | |
final clientID = 'ha_NzNADHFGe6F3m0BDREK-WDj8mqABkeRTYW8JFhFk'; | |
final response = await get(Uri.parse('https://api.unsplash.com/photos?client_id=$clientID')); | |
//print(jsonDecode(response.body)); | |
var result = ImageModel.fromJson(jsonDecode(response.body)); | |
// print(result.url); | |
// print(result.tag); | |
print(result.imageUrl); |
View main.dart
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
import 'dart:convert'; | |
void main() { | |
// this represents some response data we get from the network | |
final jsonData = '{ "name": "Pizza da Mario", "cuisine": "Italian" }'; | |
// 2. decode the json | |
final parsedJson = jsonDecode(jsonData); | |
// 3. print the type and value | |
print('${parsedJson.runtimeType} : $parsedJson'); |
View main.dart
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
void main() { | |
for (int i = 0; i < 5; i++) { | |
print('hello ${i + 1}'); | |
} | |
} |
View main.dart
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
import 'dart:async'; | |
void main() { | |
final controller = StreamController(); | |
final order = Order('chocolate'); | |
final baker = StreamTransformer.fromHandlers( | |
handleData:(cakeType,sink){ | |
if(cakeType == 'chocolate'){ | |
sink.add(Cake()); | |
}else { |
View main.dart
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
import 'dart:async'; | |
void main() { | |
final controller = StreamController(); | |
final order = Order('chocolate'); | |
final baker = StreamTransformer.fromHandlers( | |
handleData:(cakeType,sink){ | |
if(cakeType == 'chocolate'){ | |
sink.add(Cake()); | |
}else { |
View index.html
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>more-streams</title> | |
<link rel="stylesheet" href="styles.css"> | |
<script type="application/dart" src="main.dart"></script> | |
</head> |
View main.dart
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
import 'dart:convert'; | |
import 'dart:math'; | |
import 'package:http/http.dart' show get; | |
void main() async { | |
final clientID = 'ha_NzNADHFGe6F3m0BDREK-WDj8mqABkeRTYW8JFhFk'; | |
final response = await get(Uri.parse('https://api.unsplash.com/photos?client_id=$clientID')); | |
//print(jsonDecode(response.body)); | |
var result = ImageModel.fromJson(jsonDecode(response.body)); | |
print(result.url); | |
print('This are the likes: $result'); |
View index.html
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>validation</title> | |
<link rel="stylesheet" href="styles.css"> | |
<script type="application/dart" src="main.dart"></script> | |
</head> |
OlderNewer