-
Notifications
You must be signed in to change notification settings - Fork 220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build failed: Swift Compiler Error (Flutter 1.12) #45
Comments
Same issue. Did you find the solution? |
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. |
I have Flutter 1.12.13+Hotfix.8 Here's what I tried:
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),
),
);
}
} |
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:
Thanks for your help! |
I created a new Flutter project to test the package using the
pub.dev
example code. I saw that other issues mentioned iOS >=10, and Swift 5, so I modified Podfile withplatform :ios, '13.2'
andconfig.build_settings['SWIFT_VERSION'] = '5'
. However, I get Swift complier errors. I'm guessing that I've missed something, but perhaps there is an issue.Any help would be appreciated. Thanks for the package!
flutter doctor output:
Error:
The text was updated successfully, but these errors were encountered: