Skip to content

Instantly share code, notes, and snippets.

View catalunha's full-sized avatar
🎯
Focusing

Catalunha catalunha

🎯
Focusing
  • Particular
  • Brazil, Palmas-TO
View GitHub Profile
@catalunha
catalunha / main.dart
Last active March 7, 2024 22:14
programaExemplo1
void main() {
for (int i = 0; i < 10; i++) {
print('Sejam bem vindooooooooooooo ${i + 1}');
}
}
@catalunha
catalunha / readme.md
Last active January 23, 2024 21:49
about Relative vs Package imports in Flutter and Dart
@catalunha
catalunha / main.dart
Last active January 23, 2024 21:47
Why use Provider for DI in BLoC
// ***
// See comments at: https://gist.github.com/catalunha/580500220454241f2a762bdf5e2954b1
// ***
// This code is distributed under the MIT License.
// Copyright (c) 2018 Felix Angelov.
// You can find the original at https://github.com/felangel/bloc.
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
@catalunha
catalunha / main.dart
Last active December 28, 2023 13:30
streamTest
void main() async {
/// Initialize a stream of integers 0-9
Stream<int> stream = countStream(10);
/// Compute the sum of the stream of integers
int sum = await sumStream(stream);
/// Print the sum
print(sum); // 45
}
void main() {
String texto = 'Aaa bbb';
int numero = 1;
print(texto);
print(numero);
print('Texto: $texto');
print('Número: $numero');
print('Texto: $texto e Número: $numero');
print('Texto: ${texto.toUpperCase()} e Número: ${numero + 1}');
}
@catalunha
catalunha / main.dart
Last active September 1, 2023 22:53
Either
void main() async {
await getAll();
}
Future<void> getAll() async {
final <Either>[name, value] = await Future.wait([
getName(),
getIdade(),
]);
@catalunha
catalunha / main.dart
Created August 27, 2023 19:24
Heranca e Switch
void main() {
final String a = 'a';
final String b;
b = a;
print(b);
final C c = D('d');
final String f;
switch (c) {
case D(c: final dd):
f = dd;
@catalunha
catalunha / main.dart
Last active August 26, 2023 22:47
ResumoDart - Switch
// switch com => retorna valor. Ambos analisam exaustão.
enum Valores { A, B, C }
void main() {
Valores vlr1 = Valores.B;
print(vlr1);
switch (vlr1) {
case Valores.A:
print('aa');
print('aa2');
@catalunha
catalunha / main.dart
Created August 18, 2023 13:24
programaExemplo1
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}
@catalunha
catalunha / main.dart
Created August 10, 2023 23:14
programaExemplo1
void main() {
for (int i = 0; i < 5; i++) {
print('hello ${i + 1}');
}
}