Skip to content

Instantly share code, notes, and snippets.

@RemeJuan
RemeJuan / completer_hook.dart
Created July 8, 2020 18:35
Flutter hook for Completer (dart:async)
import 'dart:async';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
class _CompleterHook extends Hook<Completer> {
@override
HookState<Completer, Hook<Completer>> createState() => _CompleterHookState();
}
@RemeJuan
RemeJuan / html_utils.dart
Last active June 12, 2021 05:10
Unit Testing a Utility function that returns a Widget (Code)
dynamic launchURL(BuildContext context, String url) async {
if (url == 'about:blank') return;
if (url.startsWith('internal://')) {
final isGroups = url.contains('/groups');
if (isGroups) return _handleUnsupported(context);
}
}
@RemeJuan
RemeJuan / html_utils_test.dart
Created March 31, 2021 04:17
Unit Testing a Utility function that returns a Widget (Test)
testWidgets('cant', (tester) async {
when(mockUrlLauncherHelper.cl(any)).thenAnswer((_) async => false);
when(mockCoreCubit.state).thenReturn(fixtureCoreCubitLoaded);
// assert
const mockUrl = 'https://test.test';
Future<void> future(BuildContext context) async {
await Future.delayed(const Duration(seconds: 1));
return htmlContentUtils.launchURL(context, mockUrl);
@RemeJuan
RemeJuan / .zshrc
Created June 16, 2021 08:08
oh-my-zsh config
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/remelehane/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes