Skip to content

Commit

Permalink
add guid
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvinlim committed Feb 3, 2021
1 parent a38352e commit 4730cbe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
5 changes: 4 additions & 1 deletion lib/Maze.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import 'PathGeneration.dart';
import 'package:permission_handler/permission_handler.dart';
import 'server.dart';
import 'main.dart';
import 'package:uuid/uuid.dart';

var uuid = Uuid();

class gameButton extends StatefulWidget {
int id;
Expand Down Expand Up @@ -157,7 +160,7 @@ class gameButtonState extends State<gameButton> {
if(widget.id==99) {
var dict = {"path":path, "moves": moves, "errors": errors, "times": times};
String data = json.encode(dict);
createData("GMLT-10x10", "KI", data, "1.0");
createData("GMLT-10x10", uuid.v1().toString(), data, "1.0");
attemptNum++;
showDialog(
context: context,
Expand Down
6 changes: 5 additions & 1 deletion lib/MazeTest.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import 'dart:io';
import 'dart:convert';
import 'main.dart';
import 'server.dart';
import 'package:uuid/uuid.dart';

var uuid = Uuid();

//initialize new maze
maze maze2= new maze();
Color color1 = Colors.grey;
Expand Down Expand Up @@ -187,7 +191,7 @@ class gameButtonState extends State<gameButton> {
if(widget.id==35) {
var dict2 = {"path":path2, "moves": moves2, "errors": errors2, "times": times2};
String data = json.encode(dict2);
createData("GMLT-5x5", "KI", data, "1.0");
createData("GMLT-5x5", uuid.v1().toString(), data, "1.0");

showDialog(
context: context,
Expand Down
7 changes: 2 additions & 5 deletions lib/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ import 'package:json_annotation/json_annotation.dart';
import 'dart:async';
import 'dart:convert';

//const String serverURL = "https://x0-19.psych.umn.edu/posts";
const String serverURL = "http://160.94.0.29/posts";


@JsonSerializable(nullable: false)
Data _$DataFromJson(Map<String, dynamic> json) {
Expand Down Expand Up @@ -54,8 +51,8 @@ Future<Data> createData(
print(jsonUser);

final http.Response response = await http.post(
serverURL,
// 'http://160.94.0.29:5000/posts',
'https://x0-29.psych.umn.edu/dend/posts',
//'https://160.94.0.29/dend/posts',
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ dependencies:
rflutter_alert: ^1.0.3
http: ^0.12.2
json_annotation: ^3.1.1
uuid: ^2.2.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
Expand Down

0 comments on commit 4730cbe

Please sign in to comment.