Skip to content

Instantly share code, notes, and snippets.

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

Veli Bacik VB10

🏠
Working from home
View GitHub Profile
Future<T> _reAuthenticate<T>(GenericRequestObject request) async {
var remainingTries = MAX_REMAINING_LENGTH;
do {
remainingTries--;
try {
return await request.fetch();
} on ErrorModel catch (e) {
if (e.statusCode == 401) {
final response = await refreshToken();
SharedManager().token = response.data.token;
@VB10
VB10 / form_validation.dart
Created April 17, 2020 05:35
Form Validation Change Handler
//https://stackoverflow.com/questions/61263795/flutter-raisedbutton-stays-null
import 'package:flutter/material.dart';
class FormValidationView extends StatefulWidget {
@override
_FormValidationViewState createState() => _FormValidationViewState();
}
class _FormValidationViewState extends State<FormValidationView> {
TextEditingController _userNameController;
import 'package:flutter/material.dart';
class GridFabView extends StatefulWidget {
@override
_GridFabViewState createState() => _GridFabViewState();
}
class _GridFabViewState extends State<GridFabView> {
@override
Widget build(BuildContext context) {
import 'package:flutter/material.dart';
import 'custom_card.dart';
class SwitchView extends StatefulWidget {
@override
_SwitchViewState createState() => _SwitchViewState();
}
class _SwitchViewState extends State<SwitchView> {
@VB10
VB10 / base_model.dart
Created May 28, 2020 06:43
Base Model
abstract class BaseModel<T> {
Map<String, Object> toJson();
T fromJson(Map<String, Object> json);
}
@VB10
VB10 / main.dart
Created June 20, 2020 11:54
image types
import 'package:flutter/material.dart';
main(List<String> args) {
runApp(MaterialApp(
home: new Scaffold(
appBar: AppBar(
title: Text("Flutter Dersleri"),
),
floatingActionButton: FloatingActionButton(
onPressed: () {},
{
"Magic number": {
"scope": "dart",
"prefix": "hwaMagicNumber",
"body": "static const $1 = $2;",
"description": "Hwa Magic Number Create"
},
"Singleton Eager": {
"scope": "dart",
"prefix": "hwaEager",
class ApplicationConstants {
static const LANG_ASSET_PATH = "asset/lang";
static const IPAD_NAME = "IPAD";
}
{
"Magic number": {
"scope": "dart",
"prefix": "hwaMagicNumber",
"body": "static const $1 = $2;",
"description": "Hwa Magic Number Create"
},
"SIngleton Eager": {
"scope": "dart",
@VB10
VB10 / read_line.dart
Created July 7, 2020 12:00
Dart Read Character
import 'dart:convert';
import 'dart:io';
main() {
print('1 + 1 = ...');
var line = stdin.readLineSync(encoding: Encoding.getByName('utf-8'));
print(line.trim() == '2' ? 'Yup!' : 'Nope :(');
}