1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
* @author lsy
* @date 2019-09-24
**/
import 'package:flutter/services.dart';
import 'package:rxdart/rxdart.dart';
const BURIED_METHOD = "FLUTTER_BURIED";
const platform = const MethodChannel('flutter_bury_channel');
void jumpToH5(String jumpToName, Map params) {
Map map = {"page_name": jumpToName};
if (params != null) {
map.addAll(params);
}
platform.invokeMethod("FLUTTER_TO_H5", map);
}
void jumpToNative(String jumpToName, Map params) {
Map map = {"page_name": jumpToName};
if (params != null) {
map.addAll(params);
}
platform.invokeMethod("FLUTTER_TO_NATIVE", map);
}
Future getBuriedInfo() async {
return await platform.invokeMethod(BURIED_METHOD, null);
}
String getNowTimeSecond() {
return "${DateTime.now().millisecondsSinceEpoch}";
// String year = "${DateTime.now().year}".length == 4
// ? "${DateTime.now().year}"
// : "0${DateTime.now().year}";
// String month = "${DateTime.now().month}".length == 2
// ? "${DateTime.now().month}"
// : "0${DateTime.now().month}";
// String day = "${DateTime.now().day}".length == 2
// ? "${DateTime.now().day}"
// : "0${DateTime.now().day}";
// String hour = "${DateTime.now().hour}".length == 2
// ? "${DateTime.now().hour}"
// : "0${DateTime.now().hour}";
// String minute = "${DateTime.now().minute}".length == 2
// ? "${DateTime.now().minute}"
// : "0${DateTime.now().minute}";
// String second = "${DateTime.now().second}".length == 2
// ? "${DateTime.now().second}"
// : "0${DateTime.now().second}";
//
// return "${year}${month}${day}"
// "${hour}${minute}${second}";
}