speech 0.0.3+1 copy "speech: ^0.0.3+1" to clipboard
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
30
pub points
0%
popularity

Publisher

unverified uploader

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

License

GPL-3.0 (LICENSE)

Dependencies

flutter, permission

More

Packages that depend on speech