Skip to content

Instantly share code, notes, and snippets.


Pascal Welsch passsy

View GitHub Profile
passsy /
Created Feb 3, 2020
Run dart code coverage
# Usage: ./tool/ test/all_tests.dart
(pub global list | grep coverage) || {
# install coverage when not found
pub global activate coverage
pub global run coverage:collect_coverage \
passsy /
Last active Jan 17, 2020
Android Studio Light Theme

Colorful Java (and Kotlin) Android Studio Theme

This Android Studio Theme (or IntelliJ in general) is based on many IDEs.


passsy / main.dart
Created Dec 29, 2019
Comparison between ?? and a orDefault method
View main.dart
void main() {
final String name = "Adam";
print("=== ?? ===");
// does not execute defaultValue()
print(name ?? defaultValue());
print("=== orDefault ===");
// executes defaultValue()
passsy /
Created Dec 12, 2019
LCD Flutter Dojo

Number to LCD Kata

Kotlin coding dojo no. 8: convert a given integer number to a LCD style number, see Part 1 of NumberToLCDKata

passsy / deep_pick.dart
Created Sep 27, 2019
Sample how to use deep_pick to parse json in dart
View deep_pick.dart
import 'dart:convert';
import 'package:deep_pick/deep_pick.dart';
import 'package:http/http.dart' as http;
Future<void> main() async {
/// Request data from a json API
final response = await http.get("");
final json = jsonDecode(response.body);
passsy /
Created Dec 15, 2016
Mockito verification of the last call on a method
package com.pascalwelsch.mockito;
import org.mockito.exceptions.base.MockitoException;
import org.mockito.exceptions.verification.ArgumentsAreDifferent;
import org.mockito.internal.debugging.LocationImpl;
import org.mockito.internal.invocation.InvocationMatcher;
import org.mockito.internal.junit.JUnitTool;
import org.mockito.internal.reporting.SmartPrinter;
import org.mockito.internal.verification.api.VerificationData;
import org.mockito.internal.verification.argumentmatching.ArgumentMatchingTool;
passsy / main.dart
Created Jul 20, 2019
Flutter ListView with fixed header expanding below system navigation
View main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
passsy / main.dart
Last active May 13, 2019
Missing compile time check
View main.dart
class Apple {}
class Banana {}
List<Apple> bag([List<Apple> apples]) => apples ?? <Banana>[];
void main() {
// ok
final bag1 = bag([Apple()]);
View RxDelay.kt
object Rx {
fun <T> delayFlowable(delay: Long, timeUnit: TimeUnit, scheduler: Scheduler = Schedulers.computation(),
block: () -> Flowable<T>): Flowable<T> {
return Completable.timer(delay, timeUnit, scheduler).andThen(Flowable.defer { block() })
fun <T> delayObservable(delay: Long, timeUnit: TimeUnit, scheduler: Scheduler = Schedulers.computation(),
block: () -> Observable<T>): Observable<T> {
return Completable.timer(delay, timeUnit, scheduler).andThen(Observable.defer { block() })
public class HelloWorldActivity
extends TiActivity<HelloWorldPresenter, HelloWorldView>
implements HelloWorldView {
private TextView mOutput;
public HelloWorldPresenter providePresenter() {
return new HelloWorldPresenter();