Autofill URL and TOKEN in debug mode. (#123)
* Autofill URL and TOKEN in debug mode. * dart format. * Set ENV priority higher than prefs.
This commit is contained in:
@@ -1,3 +1,14 @@
|
|||||||
# LiveKit Flutter Example
|
# LiveKit Flutter Example
|
||||||
|
|
||||||
This app implements a video room using LiveKit's Flutter SDK. Designed to run for iOS, Android, and web.
|
This app implements a video room using LiveKit's Flutter SDK. Designed to run for iOS, Android, and web.
|
||||||
|
|
||||||
|
## Quickstart
|
||||||
|
|
||||||
|
Run example:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
flutter pub get
|
||||||
|
# Due to the inconvenience of typing on mobile devices,
|
||||||
|
# you can autofill URL and TOKEN for first run in debug mode.
|
||||||
|
flutter run --dart-define=URL=ws://${LIVEKIT_SERVER_IP}:7880 --dart-define=TOKEN=${YOUR_TOKEN}
|
||||||
|
```
|
||||||
|
|||||||
@@ -48,8 +48,12 @@ class _ConnectPageState extends State<ConnectPage> {
|
|||||||
// Read saved URL and Token
|
// Read saved URL and Token
|
||||||
Future<void> _readPrefs() async {
|
Future<void> _readPrefs() async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
_uriCtrl.text = prefs.getString(_storeKeyUri) ?? '';
|
|
||||||
_tokenCtrl.text = prefs.getString(_storeKeyToken) ?? '';
|
_uriCtrl.text = String.fromEnvironment('URL',
|
||||||
|
defaultValue: prefs.getString(_storeKeyUri) ?? '');
|
||||||
|
_tokenCtrl.text = String.fromEnvironment('TOKEN',
|
||||||
|
defaultValue: prefs.getString(_storeKeyToken) ?? '');
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_simulcast = prefs.getBool(_storeKeySimulcast) ?? true;
|
_simulcast = prefs.getBool(_storeKeySimulcast) ?? true;
|
||||||
_adaptiveStream = prefs.getBool(_storeKeyAdaptiveStream) ?? true;
|
_adaptiveStream = prefs.getBool(_storeKeyAdaptiveStream) ?? true;
|
||||||
|
|||||||
Reference in New Issue
Block a user