mirror of
https://github.com/timokz/flutter-vienna-hackathon-25.git
synced 2025-11-08 19:04:20 +01:00
Compare commits
2 commits
35edff13ef
...
642dddaaa3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
642dddaaa3 | ||
|
|
8967b1698e |
4 changed files with 13 additions and 6 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));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ class QuoteEndpoint extends Endpoint {
|
|||
throw Exception('Quote not found');
|
||||
}
|
||||
|
||||
// Only for dev
|
||||
Future<List<Quote>> getAllQuotes(Session session) async {
|
||||
final quotes = await Quote.db.find(session);
|
||||
return quotes;
|
||||
|
|
@ -66,7 +65,7 @@ class QuoteEndpoint extends Endpoint {
|
|||
}) async* {
|
||||
if (limit <= 0 || limit > 500) limit = 200;
|
||||
|
||||
final quoteStream = session.messages.createStream('quotes');
|
||||
final quoteStream = session.messages.createStream<Quote>('quotes');
|
||||
|
||||
await for (final Quote quote in quoteStream) {
|
||||
yield quote;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue