Skip to content

Instantly share code, notes, and snippets.

@jamesmoore255
Created January 7, 2020 04:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmoore255/59f49d0063bf009a18b52fea0f7450da to your computer and use it in GitHub Desktop.
Save jamesmoore255/59f49d0063bf009a18b52fea0f7450da to your computer and use it in GitHub Desktop.
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