http minimal client

This commit is contained in:
Valentin CZERYBA 2022-08-30 21:28:49 +02:00
parent 7a0731ba85
commit e5680bb350

View File

@ -1,4 +1,7 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
void main() {
runApp(const MyApp());
@ -50,7 +53,12 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
Future<void> _incrementCounter() async {
var url = Uri.http("localhost:8083", "api/v1/token");
var response = await http.get(url);
stderr.writeln('Response status: ${response.statusCode}');
stderr.writeln('Response body: ${response.body}');
setState(() {
// This call to setState tells the Flutter framework that something has
// changed in this State, which causes it to rerun the build method below