mirror of
				https://github.com/hackku21/loc-chain-app.git
				synced 2025-06-13 12:54:05 +00:00 
			
		
		
		
	added requests
This commit is contained in:
		
							parent
							
								
									d56bad22d0
								
							
						
					
					
						commit
						fc08292542
					
				
							
								
								
									
										32
									
								
								loc_chain_app/lib/util/requests.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								loc_chain_app/lib/util/requests.dart
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,32 @@
 | 
				
			|||||||
 | 
					import 'dart:convert';
 | 
				
			||||||
 | 
					import 'dart:html';
 | 
				
			||||||
 | 
					import 'dart:io';
 | 
				
			||||||
 | 
					import 'package:http/http.dart' as http;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import 'package:loc_chain_app/util/transaction_manager.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					String baseUrl = 'http://loc.glmdev.tech:8000/';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Future<http.Response> postEncounter(EncounterTransaction encounter) async {
 | 
				
			||||||
 | 
					  var payload = jsonEncode(encounter);
 | 
				
			||||||
 | 
					  var url = Uri.parse('http://loc.glmdev.tech:8000/api/v1/encounter');
 | 
				
			||||||
 | 
					  return await http.post(
 | 
				
			||||||
 | 
					    url,
 | 
				
			||||||
 | 
					    headers: <String, String>{
 | 
				
			||||||
 | 
					      'Content-Type': 'application/json',
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    body: payload,
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Future<http.Response> postExposure(ExposureTransaction exposure) async {
 | 
				
			||||||
 | 
					  var payload = jsonEncode(exposure);
 | 
				
			||||||
 | 
					  var url = Uri.parse('http://loc.glmdev.tech:8000/api/v1/exposure');
 | 
				
			||||||
 | 
					  return await http.post(
 | 
				
			||||||
 | 
					    url,
 | 
				
			||||||
 | 
					    headers: <String, String>{
 | 
				
			||||||
 | 
					      'Content-Type': 'application/json',
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    body: payload,
 | 
				
			||||||
 | 
					  );
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@ -121,6 +121,20 @@ packages:
 | 
				
			|||||||
    description: flutter
 | 
					    description: flutter
 | 
				
			||||||
    source: sdk
 | 
					    source: sdk
 | 
				
			||||||
    version: "0.0.0"
 | 
					    version: "0.0.0"
 | 
				
			||||||
 | 
					  http:
 | 
				
			||||||
 | 
					    dependency: "direct main"
 | 
				
			||||||
 | 
					    description:
 | 
				
			||||||
 | 
					      name: http
 | 
				
			||||||
 | 
					      url: "https://pub.dartlang.org"
 | 
				
			||||||
 | 
					    source: hosted
 | 
				
			||||||
 | 
					    version: "0.13.1"
 | 
				
			||||||
 | 
					  http_parser:
 | 
				
			||||||
 | 
					    dependency: transitive
 | 
				
			||||||
 | 
					    description:
 | 
				
			||||||
 | 
					      name: http_parser
 | 
				
			||||||
 | 
					      url: "https://pub.dartlang.org"
 | 
				
			||||||
 | 
					    source: hosted
 | 
				
			||||||
 | 
					    version: "4.0.0"
 | 
				
			||||||
  js:
 | 
					  js:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
@ -205,6 +219,13 @@ packages:
 | 
				
			|||||||
      url: "https://pub.dartlang.org"
 | 
					      url: "https://pub.dartlang.org"
 | 
				
			||||||
    source: hosted
 | 
					    source: hosted
 | 
				
			||||||
    version: "2.0.0"
 | 
					    version: "2.0.0"
 | 
				
			||||||
 | 
					  pedantic:
 | 
				
			||||||
 | 
					    dependency: transitive
 | 
				
			||||||
 | 
					    description:
 | 
				
			||||||
 | 
					      name: pedantic
 | 
				
			||||||
 | 
					      url: "https://pub.dartlang.org"
 | 
				
			||||||
 | 
					    source: hosted
 | 
				
			||||||
 | 
					    version: "1.11.0"
 | 
				
			||||||
  platform:
 | 
					  platform:
 | 
				
			||||||
    dependency: transitive
 | 
					    dependency: transitive
 | 
				
			||||||
    description:
 | 
					    description:
 | 
				
			||||||
 | 
				
			|||||||
@ -36,6 +36,7 @@ dependencies:
 | 
				
			|||||||
  flutter_udid: ^2.0.0
 | 
					  flutter_udid: ^2.0.0
 | 
				
			||||||
  loading_animations: ^2.2.0
 | 
					  loading_animations: ^2.2.0
 | 
				
			||||||
  openpgp: ^2.0.0-nullsafety.0
 | 
					  openpgp: ^2.0.0-nullsafety.0
 | 
				
			||||||
 | 
					  http: ^0.13.1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dev_dependencies:
 | 
					dev_dependencies:
 | 
				
			||||||
  flutter_test:
 | 
					  flutter_test:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user