import 'dart:async';

import 'package:rxdart/rxdart.dart';

import 'flip_card.dart';

///This controller used to call Fliping
class FlipCardController {
  final StreamController<bool> _controller = StreamController.broadcast();
  bool isFront = true;

  FlipCardController();

  /// Flip the card
  Future flipcard() async {
    isFront = !isFront;
    _controller.add(isFront);
  }

  bool get state => isFront;

  Stream<bool> get asStream =>
      _controller.stream.asBroadcastStream().startWith(state);
}
