add digest, http_test
This commit is contained in:
12
digest/digest.dart
Normal file
12
digest/digest.dart
Normal file
@@ -0,0 +1,12 @@
|
||||
import 'dart:convert';
|
||||
import 'package:crypto/crypto.dart';
|
||||
|
||||
// https://pub.dev/packages/crypto
|
||||
main() async {
|
||||
var bytes = utf8.encode("Hello World!");
|
||||
|
||||
var digest = sha256.convert(bytes);
|
||||
|
||||
// print("Digest as bytes: ${digest.bytes}");
|
||||
print("Digest as hex string: $digest");
|
||||
}
|
||||
5
digest/pubspec.yaml
Normal file
5
digest/pubspec.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
name:
|
||||
digest
|
||||
|
||||
dependencies:
|
||||
crypto: ^2.1.3
|
||||
8
http_test/pubspec.yaml
Normal file
8
http_test/pubspec.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
name: http_test
|
||||
description: http test
|
||||
|
||||
dependencies:
|
||||
http: ^0.12.0+2
|
||||
|
||||
|
||||
|
||||
13
http_test/ss.dart
Normal file
13
http_test/ss.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
main() async {
|
||||
var url = 'https://hatter.ink/ip/ip.jsonp';
|
||||
var response = await http.post(url, body: {
|
||||
'name': 'doodle',
|
||||
'color': 'blue'
|
||||
});
|
||||
print('Response status: ${response.statusCode}');
|
||||
print('Response body: ${response.body}');
|
||||
|
||||
print(await http.read('https://hatter.ink/ip/ip.jsonp'));
|
||||
}
|
||||
Reference in New Issue
Block a user