Skip to content

Instantly share code, notes, and snippets.

@magicleon94
Created September 1, 2020 08:05
Show Gist options
  • Save magicleon94/df7f336222e45bf7f4db7d290b27f83c to your computer and use it in GitHub Desktop.
Save magicleon94/df7f336222e45bf7f4db7d290b27f83c to your computer and use it in GitHub Desktop.
Closable Bloc
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
abstract class ClosableBloc<E, S> extends Bloc<E, S> {
var closed = false;
ClosableBloc(S initialState) : super(initialState);
@override
@mustCallSuper
Future<void> close() {
closed = true;
return super.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment