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() { | |
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() { | |
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() { | |
// variáveis podem ser modificadas | |
// String nome = "Ana Beatriz"; | |
// modificador de proteção variável (final, const) | |
// const String nome = "Ana Beatriz"; | |
// const nome = "Ana Beatriz"; | |
final String nome = "Ana Beatriz"; | |
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() { | |
//i++ | |
//i += 1 | |
//i = i + 1 | |
for (int i = 0; i < 5; i = i + 2) { | |
print('hello $i'); | |
} | |
List numeros = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; |
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 Pessoa { | |
String nome; | |
int idade; | |
Pessoa(this.nome, this.idade); | |
@override | |
String toString(){ | |
return "$nome,\t$idade"; | |
} |
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<Pessoa> pessoas = [ | |
Pessoa('Maria', 34), | |
Pessoa('João', 25), | |
Pessoa('Pedro', 23), | |
Pessoa('João', 18), | |
Pessoa('João', 17), | |
Pessoa('Lucas', 15), | |
Pessoa('Maria', 37), | |
Pessoa('Maria', 18), |
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 = [0, 5, 2, 4, 7, 1, 9, 6, 3, 8]; | |
print(numeros); | |
// [0, 5, 2, 4, 7, 1, 9, 6, 3, 8] | |
//ASC - ascendente | |
numeros.sort(); | |
print(numeros); | |
// [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
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(){ | |
// códigos que inicia a lsita de pessoas aqui | |
pessoas.sort((a, b) { | |
// Primeiro, comparar pelo campo nome | |
int comparacao = a.nome.compareTo(b.nome); | |
if (comparacao != 0) { | |
return comparacao; | |
} | |
// Se os nomes forem iguais, comparar pelo campo idade | |
return a.idade.compareTo(b.idade); |
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() { | |
//código anteriores aqui | |
pessoas.sort((a, b) { | |
// Primeiro, comparar pelo campo nome | |
int comparacao = a.nome.compareTo(b.nome); | |
if (comparacao != 0) { | |
return comparacao; | |
} | |
// Se os nomes forem iguais, comparar pelo campo idade |