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() { | |
emit().listen((value){ | |
print('Valor: $value'); | |
}); | |
} | |
Stream<int> emit() async* { | |
final numbers = [1, 2, 3, 4, 5]; |
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() { | |
emit().listen((value){ | |
print('Valor: $value'); | |
}); | |
} | |
Stream<int> emit(){ | |
return Stream.periodic(Duration(seconds: 1), (value){ | |
return value; |
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() async { | |
try { | |
final value = await httpGet("melvin"); | |
print(value); | |
} on Exception catch (err) { | |
print('Hubo un error de Exception: $err'); | |
} catch (err) { | |
print('OOPS! Error: $err'); | |
} finally { | |
print('Se completó el try-catch'); |
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() async { | |
try { | |
final value = await httpGet("melvin"); | |
print(value); | |
} catch (err) { | |
print('Error: $err'); | |
} | |
} | |
Future<String> httpGet(String url) 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
void main() { | |
httpGet("melvin").then((data) => { | |
print(data) | |
}).catchError((err) => { | |
print("error: $err") | |
}); | |
} | |
Future<String> httpGet(String url){ |
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() { | |
final batman = Murcielago(); | |
batman.volar(); | |
batman.caminar(); | |
final donald = Pato(); | |
donald.nadar(); | |
donald.caminar(); | |
donald.volar(); |
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() { | |
final batman = Murcielago(); | |
batman.volar(); | |
batman.caminar(); | |
final donald = Pato(); | |
donald.nadar(); | |
donald.caminar(); | |
donald.volar(); |
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() { | |
final ghero = GoodHero(name: 'Iron Man', power: 'Rich', isAlive: false); | |
print(ghero); | |
final bhero = BadHero(name: 'Flash', power: 'Fast', isAlive: true); | |
print(bhero); | |
} | |
enum HeroType { good, bad } |
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() { | |
final v = Square(side: -27); | |
//v.set(-2.5); | |
print( v.area ); | |
} | |
class Square { | |
double _side; |
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() { | |
final Map<String, dynamic> responseHttp = { | |
'heroes': [ | |
{'name': 'Spider Man', 'power': 'Trepar', 'isAlive': true}, | |
{ | |
'name': 'Iron Man', | |
'power': 'Traje de alta tecnología', | |
'isAlive': false | |
}, | |
{ |
NewerOlder