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
| pwe: mostra o caminho pasta atual; | |
| cd: mostra os arquivos e pasta dentro da pasta atual e acessar as pastas; | |
| cd..: acesso um nível acima da pasta atual; | |
| cd s + tab: é a inicial de qualquer arquivo ou pasta que inicia com a letra s. Ele completa; | |
| cd -: retorna pra pasta onde estava anteriormente; | |
| ls: mostra os arquivos e pasta dentro da pasta atual; | |
| ls -lah: mostra os arquivos e pasta dentro da pasta atual, bem como suas permissões; | |
| cp: copia. Ex: cp README.md app "Copia o arquivo README.md para a pasta app"; | |
| Ex2: cp README.md ./README2.md "Copia o arquivo README.md para a pasta atual com outro nome"; | |
| mv: move. Ex: mv README.md ../ "Move o arquivo README.md para a pasta de nivel acima"; |
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
| // a página atual é carregada | |
| window.location.href = "YOUR_URL"; | |
| //Toast | |
| // jquery.toast.min.js jquery.toast.min.css | |
| $.toast({ | |
| heading: 'Sucesso!', | |
| text: 'Dispositivo adicionado!', | |
| position: 'top-center', | |
| hideAfter: 1500, // in milli seconds |
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() { | |
| final valorDouble = 10.65; | |
| final valorString = '10'; | |
| final valorDecimal = 3.14668; | |
| valorDouble.round(); //Arredonda valor = 11 | |
| valorDouble.roundToDouble(); //Arredonda para double = 11.0 | |
| int.parse(valorString); //Converte de String para int | |
| int.tryParse(valorString); //Tentar converter, se não, é null | |
| valorDecimal.toStringAsFixed(2);//Deixa em duas 2 casas decimais arredondando | |
| print(valorDecimal.toStringAsFixed(2)); |
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() { | |
| const nome = 'Vlaydisson Valóis de Melo'; | |
| print(nome); | |
| var subsStringNome = nome.substring(11); //Pegar a partir do caracter 11 | |
| print(subsStringNome); | |
| var subsStringNome2 = nome.substring(0, 10); //Pegar a partir do caracter 0, 10 carateres | |
| print(subsStringNome2); | |
| if(nome.startsWith('V')){ //Testa se inicia com caracter 'V' | |
| print('Inicia com v'); | |
| } |
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() { | |
| var numeros = List.generate(10, (index) => index); | |
| print(numeros); | |
| numeros.where((numero) => numero != 5).forEach((numero) => print(numero)); //Filtra e lista ao mesmo tempo | |
| print(numeros.where((numero) => numero != 5)); //Gera uma lista sem o 5 | |
| final numerosAte5 = numeros.takeWhile((numero) => numero < 6); //Lista todos em menores que 6 | |
| print(numerosAte5.toList()); //toList transforma o iterable em List | |
| //É o inverso de takeWhile | |
| final numerosDepois5 = numeros.skipWhile((numero) => numero < 6).toList(); //Lista todos em a partir do 6, o toList pode ficar aqui | |
| print(numerosDepois5); |
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() { | |
| var numeros = List.generate(10, (index) => index+1); | |
| var nomes = ['Vlaydisson', 'Fernanda', 'Vladymir', 'Juvenil']; | |
| //For simples | |
| for(var i = 0; i < numeros.length; i++){ | |
| print(numeros[i]); | |
| } | |
| //For=in | |
| for(var nome in nomes){ |
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(){ | |
| //Criar lista | |
| List<String> listLetras = ['a', 'b', 'c']; //ou | |
| List listLetras = <String>['a', 'b', 'c']; //ou | |
| var listLetras = ['a', 'b', 'c']; | |
| List listNumeros = <int>[]; //deve adicinar sem int | |
| //! Em null-safaty | |
| List<String> nomes = []; //Não pode ser nulo | |
| List<String>? nomes2; //Pode ser nulo |
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
| String? nomeGlobal; | |
| void main(){ | |
| String nomeLocal = nomeGlobal; | |
| String sobreNome = ' Valóis'; | |
| //if(nomeGlobal != null){} //Não permitido | |
| if(nomeLocal != null){ //Permitido, mas não recomendado | |
| var nomeCompleto = nomeLocal + sobreNome; | |
| } | |
| var nomeCompleto = (nome??'Vlaydisson') + sobreNome; //Recomendado em caso de nulo (null aware operator) |
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
| //Variável pode ser nula | |
| String? nome; | |
| //Estou garantindo que ela não vai ser nula | |
| nome!.length; | |
| // ************************************************************ | |
| //Variável de nivel global deve ser inicializada antes de usar | |
| //Isso não é permitido | |
| int idadeGlobal; |