feat(api_connection): add test request to VBB API and ignore env files

This commit is contained in:
fbachus
2026-05-15 17:09:18 +02:00
parent b8d226fd38
commit 274c27c7e1
5 changed files with 103 additions and 3 deletions
+19 -1
View File
@@ -1,6 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'api_handler.dart';
void main() {
void main() async {
await dotenv.load();
runApp(const MyApp());
}
@@ -55,6 +58,10 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
//String API_KEY = ApiHandler.accessID;
String API_KEY = "no telly";
//Future<Map<String, dynamic>> ?id;
String id = '';
void _incrementCounter() {
setState(() {
@@ -66,6 +73,10 @@ class _MyHomePageState extends State<MyHomePage> {
_counter++;
});
}
void show_result(Future<String> future_id) async {
id = await future_id;
setState(() { });
}
@override
Widget build(BuildContext context) {
@@ -109,6 +120,13 @@ class _MyHomePageState extends State<MyHomePage> {
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
Text('API key from ENV is $API_KEY'),
MaterialButton(onPressed: () { show_result(ApiHandler.findStations('S Biesdorf')); setState(() {}); },
child: Text(
'Search for \'S Biesdorf\''
),
),
Text(id)
],
),
),