Skip to content

Instantly share code, notes, and snippets.

View eduardoflorence's full-sized avatar

Eduardo Florence eduardoflorence

View GitHub Profile
@eduardoflorence
eduardoflorence / main.dart
Created October 5, 2020 22:02
Dart Future - Testes de timeout
// Problema: then está sendo executado mesmo que timeout e catchError seja acionado
void main() {
final item = teste()
.then((value) => print('Executou then'))
.timeout(Duration(seconds: 2),
onTimeout: () {
throw ('Timeout expirado');
}
)
.catchError((e) => print('Erro $e'))
@eduardoflorence
eduardoflorence / main.dart
Created October 27, 2020 18:09
GetX - Sample StateMixin
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:dio/dio.dart';
void main() {
runApp(GetMaterialApp(
initialRoute: '/home',
getPages: [
GetPage(
name: '/home',
@eduardoflorence
eduardoflorence / main.dart
Created December 13, 2020 16:55
GetX - Sample GetNotifier
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:dio/dio.dart';
void main() {
runApp(GetMaterialApp(
initialRoute: '/home',
getPages: [
GetPage(
name: '/home',
@eduardoflorence
eduardoflorence / main.dart
Created December 14, 2020 22:48
GetX - Sample TabBar
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(GetMaterialApp(home: Home()));
}
class Home extends StatelessWidget {
@override
Widget build(BuildContext context) {
@eduardoflorence
eduardoflorence / main.dart
Created December 16, 2020 20:54
GetX - Sample Hook
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(GetMaterialApp(home: HomePage()));
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
@eduardoflorence
eduardoflorence / main.dart
Last active October 15, 2024 01:44
GetX - Sample Drawer
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(GetMaterialApp(
navigatorKey: Get.key,
initialRoute: '/home',
getPages: [
GetPage(
name: '/home',
@eduardoflorence
eduardoflorence / main.dart
Created December 24, 2020 20:03
GetX - Sample GetConnect
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(GetMaterialApp(
initialRoute: '/home',
getPages: [
GetPage(
name: '/home',
page: () => HomePage(),
@eduardoflorence
eduardoflorence / main.dart
Created December 28, 2020 20:53
Dart - List with submodel
Future main() async {
Map<String, dynamic> res = {
"content": [
{
"from_info": {
"address": {
"address_string": "Av. Paulista, 302 - Bela Vista, São Paulo - SP, 01310-000, Brazil",
"latitude": "-23.5688619",
"longitude": "-46.6464484"
@eduardoflorence
eduardoflorence / main.dart
Created January 13, 2021 19:29
GetX - Sample GetWidget
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(GetMaterialApp(
debugShowCheckedModeBanner: false,
initialRoute: '/home',
defaultTransition: Transition.fade,
getPages: [
GetPage(
@eduardoflorence
eduardoflorence / main.dart
Last active April 10, 2024 10:40
Getx - Sample Form
import 'package:flutter/material.dart';
import 'package:get/get.dart';
void main() {
runApp(GetMaterialApp(
initialRoute: '/login',
getPages: [
GetPage(
name: '/login',
page: () => LoginPage(),