speech 0.0.3+1
speech: ^0.0.3+1 copied to clipboard

discontinued

This plugin provides one method which takes the filename of a (valid) json file containing gcloud speech credentials, uses this to connect to google's speech api and sends a real-time transcript back

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:speech/speech.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _text = "";
  int _index = 0;
  StreamSubscription<dynamic> listener;

  var _icon = [
    new Icon(Icons.keyboard_voice),
    new Icon(Icons.stop),
  ];

  var _color = [
    Colors.cyan,
    Colors.red
  ];

  void _buttonPressed() async {
    if (_index == 0) listener = transcript("/storage/emulated/0/Download/hypnote.json").listen((data) => _append(data), onError: (error) => print(error));
    else listener.cancel();
    _switchButton();
  }

  void _switchButton() => setState(() => _index = (_index + 1) % 2);
  void _append(String text) => setState(() => _text += text);


  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Life Transcript'),
          backgroundColor: Colors.cyan,
        ),
        body: Center(
          child: new Text(_text),
        ),
        floatingActionButton: FloatingActionButton(
          child: _icon[_index],
          backgroundColor: _color[_index],
          onPressed: _buttonPressed,
        ),
      ),
    );
  }
}
0
likes
0
pub points
4%
popularity

This plugin provides one method which takes the filename of a (valid) json file containing gcloud speech credentials, uses this to connect to google's speech api and sends a real-time transcript back

Repository (GitHub)
View/report issues

Documentation

API reference

License

LICENSE

Dependencies

flutter, permission

More

Packages that depend on speech