24 lines
485 B
Dart
24 lines
485 B
Dart
|
|
import 'dart:async';
|
||
|
|
|
||
|
|
import 'package:rxdart/rxdart.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);
|
||
|
|
}
|