Skip to content

Instantly share code, notes, and snippets.

View mrverdant13's full-sized avatar
Hot reloading

Karlo Verde mrverdant13

Hot reloading
View GitHub Profile
@mrverdant13
mrverdant13 / main.dart
Last active February 7, 2021 06:32
Async call to same object method in parallel
// Dartpad: https://dartpad.dartlang.org/862be4c1fb446bbb36357a0615bba3b1
class AsyncClass {
int value = 0;
int numberOfCalls = 0;
Future<String> getAsyncValue(Duration duration) async {
final callerNumber = ++numberOfCalls;
await Future.delayed(duration);
value++;
@mrverdant13
mrverdant13 / screen.dart
Created August 4, 2021 05:12
`setState` coverage test
import 'package:flutter/material.dart';
class SetStateScreen extends StatelessWidget {
const SetStateScreen({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(
@mrverdant13
mrverdant13 / script.sh
Created August 10, 2021 03:29
Use Flutter with WSL
#!/usr/bin/env bash
# 1
# Install the required GNU C Library and Java Dev Kit
# The especific packages may vary depending on your WSL distribution (these ones work for Ubuntu).
sudo apt-get install -y libc6-dev-i386 lib32z1 openjdk-8-jdk
# 2
# Make the JDK globally accessible.
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
@mrverdant13
mrverdant13 / melos.yaml
Created August 15, 2021 02:50
Melos config for Flutter
name: bloc_samples
packages:
- "*"
- analysis_options/*
- features/**
scripts:
gen:single:
run: melos exec -c 1 --fail-fast -- flutter pub run build_runner build --delete-conflicting-outputs