Skip to content

Instantly share code, notes, and snippets.

View ProZhar's full-sized avatar
🏠
Working from home

ProZhar

🏠
Working from home
View GitHub Profile
@ProZhar
ProZhar / main.dart
Last active October 29, 2022 13:03 — forked from eduardoflorence/main.dart
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(
@ProZhar
ProZhar / main.dart
Created February 18, 2023 13:15 — forked from eduardoflorence/main.dart
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'))
@ProZhar
ProZhar / main.dart
Created February 18, 2023 13:15 — forked from eduardoflorence/main.dart
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',
@ProZhar
ProZhar / main.dart
Created February 18, 2023 13:15 — forked from eduardoflorence/main.dart
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',
@ProZhar
ProZhar / main.dart
Created February 18, 2023 13:16 — forked from eduardoflorence/main.dart
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) {
@ProZhar
ProZhar / main.dart
Created February 18, 2023 13:16 — forked from eduardoflorence/main.dart
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) {
@ProZhar
ProZhar / main.dart
Created February 18, 2023 13:16 — forked from eduardoflorence/main.dart
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',
@ProZhar
ProZhar / main.dart
Created February 18, 2023 13:16 — forked from eduardoflorence/main.dart
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(),
@ProZhar
ProZhar / main.dart
Created February 18, 2023 13:16 — forked from eduardoflorence/main.dart
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"
@ProZhar
ProZhar / main.dart
Created February 18, 2023 13:17 — forked from eduardoflorence/main.dart
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(),