FaucetHub/lib/Backend/hoarder.dart

26 lines
681 B
Dart

import 'dart:convert';
import 'package:faucethub/Backend/DebugHelper.dart';
import 'package:faucethub/Backend/brains.dart';
import 'package:http/http.dart' as http;
class Hoarder{
static List<dynamic> GamesJson = [];
static void GrabInitData() async{
var response = null;
try {
response = (await http.post(Uri.parse('${Brain.API_ENDPOINT}get_games.php')));
Debug.LogError(response.body.toString());
GamesJson=[];
List<String> games = response.body.toString().split("<td>");
games.forEach((game) {
GamesJson.add(jsonDecode(game));
});
} catch (e) {
Debug.LogError("Error while loading games : $e");
}
}
}