Skip to content

Instantly share code, notes, and snippets.

View jacobaraujo7's full-sized avatar

Jacob Moura jacobaraujo7

View GitHub Profile

After extensive feedback, we are changing the API to make the standard more intuitive and user-friendly. We also added stricter limits for more complex projects and introduced a “predictability” system in state changes to improve tracking and debugging while reducing unwanted side effects. Some changes may seem drastic, but we believe everything will make more sense once you give this new API a chance.

Let’s start with what has been removed, followed by the new features:

  • [BREAKING CHANGE]: Removed all collections such as RxList, RxSet, and RxMap. Asynchronous converters like RxFuture and RxStream have also been removed. Initially, these helpers seemed beneficial, but they soon complicated things, prompting us to remove them. Consequently, all extensions have been removed as well. Now there is only one way to create an Atom:
    final productsState = atom<List<Product>>([]);
  • [BREAKING CHANGE]: Due to the new API capabilities, some widgets have changed. ASP now ado
slidy: '1'
variables:
var1: myVariable # Gets ${Local.var1}
var2: ${System.env.USER} # Gets system env variables ${Local.var2}
scripts:
# Simple command (slidy run doctor)
doctor: flutter doctor
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() {
return HomeState();
}
}
class HomeState extends State<HomePage> with SingleTickerProviderStateMixin {
@jacobaraujo7
jacobaraujo7 / exercicio1.txt
Created January 10, 2022 18:52
Exercício 1
1. Criar uma estrutura com rotas nomeadas para adicionar todos os desafios.
PRIMEIRO EXERCÍCIO
- Consumo de API rest.
Regras:
- Usar Provider
- Usar ChangeNotifier
@jacobaraujo7
jacobaraujo7 / cnpj_and_cpf_input_format.dart
Created December 4, 2021 23:44
// Teste de construção de um CNPJ e CPF Format sem view
class CNPJAndCPFInputFormat extends TextInputFormatter {
@override
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
var value = _prepareValue(newValue);
if (value.isNotEmpty && value.length <= 11) {
value = _appendMask(value, '###.###.###-##');
} else if (value.isNotEmpty && value.length <= 14) {
value = _appendMask(value, '##.###.###/####-##');
} else if (value.length > 14) {
return oldValue;
DESAFIO ANTERIOR:
https://gist.github.com/jacobaraujo7/e046230b9708fb63387421b87f835f83
VOCÊ SERÁ DESAFIADO A ESCALAR O SEU PROJETO, COLOCANDO UMA OPÇÃO DE CACHE NA REQUISIÇÃO PARA FUNCIONAR OFFLINE.
EXISTE VARIAS FORMAS DE FAZER ISSO, UM EXEMPLO SERIA UTILIZAR O HYDRATED_BLOC, O QUE ESTÁ PROIBIDO NESSE DESAFIO.
REGRAS:
- CRIE UM SEGUNDO BLOC RESPONSÁVEL PELO CACHE DINÂMICO.
- UNIR OS DOIS BLOCS.
- PROIBIDO O USO DE MIDDLEWARE E HYDRATED_BLOC.
CONSUMIR UMA API REST USANDO BLOC, REPOSITORY/DATASOURCE
## API PARA CONSUMIR
https://www.intoxianime.com/?rest_route=/wp/v2/posts&page=1&per_page=10
- page: essa váriavel pode ir de 1 a 100 e representa a quantidade de itens que a api trará.
- per_page: Quantidade de itens por página.
REGRAS:
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:google_ml_kit/google_ml_kit.dart';
import 'qrcode_controller.dart';
class QrcodePage extends StatefulWidget {
final String title;
const QrcodePage({Key key, this.title = "Qrcode"}) : super(key: key);
counter.observer(
onState: (state) => print(state),
onError: (error) => print(error),
onLoading: (loading) => print(loading),
);
...
Widget build(BuildContext context){
return Scaffold(
body: Center(
child: ScopedBuilder(
store: counter,
onState: (context, state) => Text('$state'),
onError: (context, error) => Text(error.toString()),
onLoading: (context) => CircularProgressIndicator(),