一个小应用
https://dart.cn/tutorials/server/get-started#3-create-a-small-app
| dart create -t console dart_tmp
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 | import 'package:dart_tmp/dart_tmp.dart' as dart_tmp;
import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'dart:typed_data';
import 'dart:convert';
void main(List<String> arguments) async {
for (var i = 1; i < 70; i++) {
var filePath = "/Users/nocilantro/Desktop/log_desktop_proxy/test${i}.bin";
File file = new File(filePath);
Uint8List fileBytes = await file.readAsBytes();
try {
String str = utf8.decode(fileBytes, allowMalformed: true);
str = str.substring(4, str.length);
var u8data = utf8.encode(str);
print('$str\n');
} catch (e) {
print('error: $e');
}
}
}
|
添加依赖:
| dependencies:
# path: ^1.8.0
msgpack_dart: ^1.0.1
|