13 lines
306 B
Dart
13 lines
306 B
Dart
|
import 'dart:convert';
|
||
|
|
||
|
import 'package:flutter/foundation.dart';
|
||
|
import 'package:http/http.dart' as http;
|
||
|
|
||
|
Future<Map<String, dynamic>> getJson(String uri) async {
|
||
|
if (!kIsWeb) {
|
||
|
uri = "http://127.0.0.1:8000$uri";
|
||
|
}
|
||
|
final resp = await http.get(Uri.parse(uri));
|
||
|
return jsonDecode(resp.body);
|
||
|
}
|