GithubHelp home page GithubHelp logo

Comments (5)

mustakimpawle avatar mustakimpawle commented on August 14, 2024

Same issue. Did you find the solution?

from speech_to_text.

sowens-csd avatar sowens-csd commented on August 14, 2024

Sorry for the delay. I'll try a new project myself. In the meantime I'd suggest opening the project in Xcode and set the Swift version there.

from speech_to_text.

mdvandergon avatar mdvandergon commented on August 14, 2024

Hey, thank you for looking into it. No solution yet. I have been setting the Swift version in Xcode, but it looks like I get the same issue. I might have some more time to investigate this week.

swift 5 Xcode

from speech_to_text.

sowens-csd avatar sowens-csd commented on August 14, 2024

I have Flutter 1.12.13+Hotfix.8

Here's what I tried:

  1. flutter create --org com.csdcorp --ios-language swift --android-language kotlin .
  2. build and launch the resulting project for iOS, all working
  3. add speech_to_text: ^1.1.0 to pubspec.yaml dependencies
  4. rebuild and launch, all working
  5. add speech to text to main.dart and initialize it
  6. add required permission descriptions to Info.plist
  7. rebuild and launch, all working, speech recognition functional

So there doesn't appear to be a compile problem with the plugin and the latest version of Flutter. Can you tell me if I've done something differently than you're doing? Here's the full source of main.dart in case it's of help. I made only the minimal changes required to the example program to add a simple speech usage to it.

import 'package:flutter/material.dart';
import 'package:speech_to_text/speech_recognition_result.dart';
import 'package:speech_to_text/speech_to_text.dart';

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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);
  final String title;

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  SpeechToText _speechToText;
  bool _speechReady = false;
  String _wordsSpoken = "";
  int _counter = 0;

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

  Future<void> _startSpeech() async {
    _speechToText = SpeechToText();
    _speechReady = await _speechToText.initialize();
    if (_speechReady) {
      _speechToText.listen(onResult: _resultHandler, partialResults: true);
    }
    setState(() {});
  }

  void _resultHandler(SpeechRecognitionResult result) {
    setState(() {
      _wordsSpoken = result.recognizedWords;
    });
  }

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(_speechReady ? 'Speech is now ready' : 'Speech not ready yet'),
            Text(_wordsSpoken),
            Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ),
    );
  }
}

from speech_to_text.

mdvandergon avatar mdvandergon commented on August 14, 2024

Hi there, sorry for the delay and thank you for sharing the example. I can confirm that there is no compile issue anymore with the latest package. I took these steps, in addition to:

  1. updating to the latest version speech_to_text: '>=2.0.1',
  2. updating to the latest version of xcode 11.4 (possibly unrelated to this working)
  3. running pod disintegrate and then pod install in my project(s).

Thanks for your help!

from speech_to_text.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.