You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import 'dart:async';
|
|
|
|
|
|
|
|
import 'package:flutter_tts/flutter_tts.dart';
|
|
|
|
|
|
|
|
class RobotProvider {
|
|
|
|
static final RobotProvider _singleton = RobotProvider._internal();
|
|
|
|
var value;
|
|
|
|
StreamController<Map> controller = StreamController<Map>.broadcast();
|
|
|
|
FlutterTts flutterTts = FlutterTts();
|
|
|
|
getData() {
|
|
|
|
// return data;
|
|
|
|
}
|
|
|
|
intStream() {
|
|
|
|
controller.add({});
|
|
|
|
}
|
|
|
|
|
|
|
|
setValue(Map data) {
|
|
|
|
value = data;
|
|
|
|
controller.add(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
factory RobotProvider() {
|
|
|
|
return _singleton;
|
|
|
|
}
|
|
|
|
|
|
|
|
RobotProvider._internal();
|
|
|
|
speak(data) async {
|
|
|
|
await flutterTts.speak(data);
|
|
|
|
}
|
|
|
|
}
|