This file contains hidden or 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() { | |
List<Map> alunos = buscarAlunosQueVeioHojeNoBancoDeDados(); | |
print(alunos); | |
String? nome; | |
double dinheiro; | |
dinheiro = 0.50; | |
print(dinheiro); | |
print(nome); | |
This file contains hidden or 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() { | |
int numero = 10; | |
double dinheiro = 10.55; | |
String nome = "Ana Beatriz"; | |
bool temAula = true; | |
List<String> alunos = ["Gustavo", nome, "Criss", "Natã", "Ari"]; | |
print(alunos[0]); | |
print(numero); | |
print(dinheiro); | |
print(nome); |
This file contains hidden or 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() { | |
int diaAniversario = 10; | |
int diaFeriado = 20; | |
bool ehFeriado = verificarFeriado(diaFeriado); | |
//String texto = if (ehFeriado) "Sim" else "Não"; | |
String texto = (ehFeriado) ? "Sim" :"Não"; | |
print("É feriado: $texto"); |
This file contains hidden or 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 = -2; i < 5; i++) { | |
if(i > 3){ | |
print("indice maior que 3"); | |
} | |
if(i <= 3){ | |
print("indice menor que 3"); | |
} | |
if(i != 3){ | |
print("indice diferente de 3"); |
This file contains hidden or 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() { | |
List<int> numeros = pegarNumerosNoBackEnd(); | |
print(numeros[0]); | |
print(numeros[1]); | |
print(numeros[2]); | |
print(numeros[3]); | |
List<String> nomes = pegarNomesDePessoasNoBancoDeDados(); | |
print(nomes.length); |
This file contains hidden or 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() { | |
List<int> numeros = pegarNumerosNoBackEnd(); | |
print(numeros[0]); | |
print(numeros[1]); | |
print(numeros[2]); | |
print(numeros[3]); | |
List<String> nomes = pegarNomesDePessoasNoBancoDeDados(); | |
print(nomes.length); |
This file contains hidden or 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() { | |
int idadePessoa = trazerIdadeDaTela(); | |
// valor da direita para a esquerda | |
// variavel <<< valor | |
String nome = trazerNomeDaTela(); | |
double salario = trazerSalarioDaTela(); | |
This file contains hidden or 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
class _MyAppState extends State<MyApp> { | |
late Future<Album> futureAlbum; | |
@override | |
void initState() { | |
super.initState(); | |
futureAlbum = fetchAlbum(); | |
} | |
// ··· | |
} |
This file contains hidden or 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'; | |
import 'dart:convert'; | |
import 'package:flutter/material.dart'; | |
import 'package:http/http.dart' as http; | |
Future<Album> fetchAlbum() async { | |
final response = await http | |
.get(Uri.parse('https://jsonplaceholder.typicode.com/albums/1')); | |
if (response.statusCode == 200) { | |
// If the server did return a 200 OK response, | |
// then parse the JSON. |
This file contains hidden or 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
FutureBuilder<Album>( | |
future: futureAlbum, | |
builder: (context, snapshot) { | |
if (snapshot.hasData) { | |
return Text(snapshot.data!.title); | |
} else if (snapshot.hasError) { | |
return Text('${snapshot.error}'); | |
} | |
// By default, show a loading spinner. | |
return const CircularProgressIndicator(); |