Created
January 7, 2020 04:27
-
-
Save jamesmoore255/59f49d0063bf009a18b52fea0f7450da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:http/http.dart' as http; | |
import 'package:twilio_video_tutorial/twilio_video_tutorial.dart'; | |
void main() => runApp( | |
MaterialApp( | |
title: "Twilio Video Call Example", | |
home: MyApp(), | |
), | |
); | |
class MyApp extends StatefulWidget { | |
@override | |
_MyAppState createState() => _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> { | |
String _twilioToken; | |
@override | |
void initState() { | |
super.initState(); | |
} | |
Future<String> getTwilioToken() async { | |
http.Response response = | |
await http.post("https://9d6a95da.ngrok.io/twilio/token"); | |
return response.body; | |
} | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
appBar: AppBar( | |
title: const Text('Plugin example app'), | |
), | |
floatingActionButton: FloatingActionButton( | |
child: Icon(Icons.video_call), | |
onPressed: () async { | |
_twilioToken = await getTwilioToken(); | |
Navigator.push( | |
context, | |
MaterialPageRoute( | |
builder: (context) => | |
TwilioVideoTutorial(twilioToken: _twilioToken), | |
), | |
); | |
}, | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment