Skip to content

Instantly share code, notes, and snippets.

View KoalityJustin's full-sized avatar

Justin Langley KoalityJustin

View GitHub Profile
@KoalityJustin
KoalityJustin / main.dart
Last active December 26, 2023 06:01
All You Need
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
extension TestingHelpers on WidgetTester {
/// Helper method for tapping a finder, and for optionally choosing the index
/// if the finder finds multiple and if we should scroll to before tapping.
Future<void> tapFinder(
Finder finder, {
@KoalityJustin
KoalityJustin / main.dart
Created September 14, 2023 21:00
Nullable value for non-nullable function call
extension NotNullFunctionCall<T> on void Function(T) {
void maybeCall(T? value) {
if (value != null) {
return this.call(value);
}
}
}
void navigateTo(int index) {
print('The index is: $index');