Documentation

Powered by Algolia

Alan Flutter Framework


The Alan Flutter plugin helps you to integrate your voice experience and Alan Studio script into your Flutter app

Getting Started

  1. Add Alan Voice dependency to your app

your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
    ...

  alan_voice: 0.5.0    
  1. Clone the Flutter sample application repository and open main.dart file.

First add alanvoice_ package dependency

import 'package:alan_voice/alan_voice.dart';
  1. Locate the MyButtonState class and remove everything from it and paste following code:
class MyButtonState extends State<MyButton> {
  bool _enabled = true; //start button state

  void _initAlanButton() async {
    //init Alan with sample project id
    AlanVoice.initButton("8e0b083e795c924d64635bba9c3571f42e956eca572e1d8b807a3e2338fdd0dc/stage");

    setState(() {
      _enabled = false;
    });
}
  1. Now, we need to modify main widget. Locate this section of the code:
new Text(displayedString, style: new TextStyle(fontSize: 40.0)),

and replace it with:

new Text("Alan voice example", style: new TextStyle(fontSize: 40.0)),
  1. Next, locate the section of code in the RaisedButton widget params:

    onPressed: onPressOfButton

and replace it with:

onPressed: _initAlanButton

That's it. Now run your app and press the button!