mirror of
https://github.com/timokz/flutter-vienna-hackathon-25.git
synced 2025-11-08 19:04:20 +01:00
move client instantiation into main
This commit is contained in:
parent
35edff13ef
commit
8967b1698e
3 changed files with 12 additions and 4 deletions
|
|
@ -22,9 +22,14 @@ class FunmapMgr {
|
|||
// address by running `ipconfig` on Windows or `ifconfig` on Mac/Linux.
|
||||
// You can set the variable when running or building your app like this:
|
||||
// E.g. `flutter run --dart-define=SERVER_URL=https://api.example.com/`
|
||||
const serverUrlFromEnv = String.fromEnvironment('SERVER_URL');
|
||||
final serverUrl = serverUrlFromEnv.isEmpty ? 'http://localhost:8080/' : serverUrlFromEnv;
|
||||
|
||||
client = Client(serverUrl, connectionTimeout: const Duration(seconds: 5))..connectivityMonitor = FlutterConnectivityMonitor();
|
||||
const serverUrlFromEnv = String.fromEnvironment('SERVER_URL');
|
||||
final serverUrl =
|
||||
serverUrlFromEnv.isEmpty ? 'http://$localhost:8080/' : serverUrlFromEnv;
|
||||
|
||||
client = Client(serverUrl, connectionTimeout: const Duration(seconds: 5))
|
||||
..connectivityMonitor = FlutterConnectivityMonitor();
|
||||
|
||||
client.openStreamingConnection();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:wien_talks_flutter/helper/funmap_mgr.dart';
|
||||
import 'package:wien_talks_flutter/helper/go_router.dart';
|
||||
|
||||
void main() {
|
||||
FunmapMgr();
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ class AddQuoteFab extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FloatingActionButton(onPressed: () {
|
||||
FunmapMgr().client.quote.createQuote(CreateQuoteRequest(text: 'Quote Text', lat: 22, lng: 140));
|
||||
FunmapMgr().client.quote.createQuote(
|
||||
CreateQuoteRequest(text: 'Quote Text', lat: 22, lng: 140));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue