Skip to content

Instantly share code, notes, and snippets.

Created July 8, 2020 18:35
What would you like to do?
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> {
HookState<Completer, Hook<Completer>> createState() => _CompleterHookState();
class _CompleterHookState extends HookState<Completer, _CompleterHook> {
Completer _completer;
void initHook() {
_completer = Completer<void>();
Completer build(BuildContext context) => _completer;
Completer<void> useCompleterHook() {
return Hook.use(_CompleterHook());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment