Skip to content

Instantly share code, notes, and snippets.

View HenriqueNas's full-sized avatar
:shipit:
damn.. Dart is really cool

HenriqueNas HenriqueNas

:shipit:
damn.. Dart is really cool
View GitHub Profile
@HenriqueNas
HenriqueNas / main.dart
Created August 16, 2024 18:28
STATE Design Pattern in Dart
void main() {
final porta = Porta(PortaAberta());
print(porta.estado);
porta.fechar();
print(porta.estado);
porta.trancar();
print(porta.estado);
porta.abrir();
print(porta.estado);
@HenriqueNas
HenriqueNas / page_state_notifier.dart
Last active July 3, 2025 15:58
Easiest way to scale your management of your Flutter page/widget state without any package.
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
/// Defines the possible states of a UI page or widget.
///
/// This enum helps to clearly represent different stages of a UI,
/// such as waiting for data (`loading`), displaying content (`success`),
/// or indicating an issue (`error`).