migrate to null safe

master
Weicheng Zhu 2021-08-18 22:10:15 +08:00
parent 214ec544ed
commit a4dfe2f8e6
8 changed files with 215 additions and 215 deletions

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/beetle/Desktop/finogeeks/gitlab/finosprite/finclip-flutter-sdk/","dependencies":[]}],"android":[{"name":"mop","path":"/Users/beetle/Desktop/finogeeks/gitlab/finosprite/finclip-flutter-sdk/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"mop","dependencies":[]}],"date_created":"2021-08-13 09:53:09.007824","version":"2.2.2"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"mop","path":"/Users/weichengzhu/dev/flutter/mop-flutter-sdk/","dependencies":[]}],"android":[{"name":"mop","path":"/Users/weichengzhu/dev/flutter/mop-flutter-sdk/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"mop","dependencies":[]}],"date_created":"2021-08-18 22:10:00.612245","version":"2.2.3"}

View File

@ -1,124 +1,124 @@
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io';
import 'package:mop/mop.dart';
// import 'package:flutter/material.dart';
// import 'dart:async';
// import 'dart:io';
// import 'package:mop/mop.dart';
void main() => runApp(MyApp());
// void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
// class MyApp extends StatefulWidget {
// @override
// _MyAppState createState() => _MyAppState();
// }
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
init();
}
// class _MyAppState extends State<MyApp> {
// @override
// void initState() {
// super.initState();
// init();
// }
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> init() async {
if (Platform.isIOS) {
final res = await Mop.instance.initialize(
'22LyZEib0gLTQdU3MUauAZ0pZVbKTWGmNN6Lx8hXhIkA', '74bde5fad53a817c',
apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
print(res);
} else if (Platform.isAndroid) {
final res = await Mop.instance.initialize(
'22LyZEib0gLTQdU3MUauAZ0pZVbKTWGmNN6Lx8hXhIkA', '74bde5fad53a817c',
apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
print(res);
}
if (!mounted) return;
}
// // Platform messages are asynchronous, so we initialize in an async method.
// Future<void> init() async {
// if (Platform.isIOS) {
// final res = await Mop.instance.initialize(
// '22LyZEib0gLTQdU3MUauAZ0pZVbKTWGmNN6Lx8hXhIkA', '74bde5fad53a817c',
// apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
// print(res);
// } else if (Platform.isAndroid) {
// final res = await Mop.instance.initialize(
// '22LyZEib0gLTQdU3MUauAZ0pZVbKTWGmNN6Lx8hXhIkA', '74bde5fad53a817c',
// apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
// print(res);
// }
// if (!mounted) return;
// }
// 5e637a18cbfae4000170fa7a
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('凡泰极客小程序 Flutter 插件'),
),
body: Center(
child: Container(
padding: EdgeInsets.only(
top: 20,
),
child: Column(
children: <Widget>[
Container(
width: 140,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5)),
gradient: LinearGradient(
colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
stops: const [0.0, 1.0],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: FlatButton(
onPressed: () {
Mop.instance.openApplet('5ea03fa563cb900001d73863',
path: 'pages/index/index', query: '');
},
child: Text(
'打开画图小程序',
style: TextStyle(color: Colors.white),
),
),
),
SizedBox(height: 30),
Container(
width: 140,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5)),
gradient: LinearGradient(
colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
stops: const [0.0, 1.0],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: FlatButton(
onPressed: () {
Mop.instance.openApplet('5ea0401463cb900001d73865');
},
child: Text(
'打开官方小程序',
style: TextStyle(color: Colors.white),
),
),
),
SizedBox(height: 30),
Container(
width: 140,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5)),
gradient: LinearGradient(
colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
stops: const [0.0, 1.0],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
child: FlatButton(
onPressed: () {
Mop.instance.openApplet('5ea0412663cb900001d73867');
},
child: Text(
'我的对账单',
style: TextStyle(color: Colors.white),
),
),
),
],
),
),
),
),
);
}
}
// // 5e637a18cbfae4000170fa7a
// @override
// Widget build(BuildContext context) {
// return MaterialApp(
// home: Scaffold(
// appBar: AppBar(
// title: const Text('凡泰极客小程序 Flutter 插件'),
// ),
// body: Center(
// child: Container(
// padding: EdgeInsets.only(
// top: 20,
// ),
// child: Column(
// children: <Widget>[
// Container(
// width: 140,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(Radius.circular(5)),
// gradient: LinearGradient(
// colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
// stops: const [0.0, 1.0],
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// ),
// ),
// child: FlatButton(
// onPressed: () {
// Mop.instance.openApplet('5ea03fa563cb900001d73863',
// path: 'pages/index/index', query: '');
// },
// child: Text(
// '打开画图小程序',
// style: TextStyle(color: Colors.white),
// ),
// ),
// ),
// SizedBox(height: 30),
// Container(
// width: 140,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(Radius.circular(5)),
// gradient: LinearGradient(
// colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
// stops: const [0.0, 1.0],
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// ),
// ),
// child: FlatButton(
// onPressed: () {
// Mop.instance.openApplet('5ea0401463cb900001d73865');
// },
// child: Text(
// '打开官方小程序',
// style: TextStyle(color: Colors.white),
// ),
// ),
// ),
// SizedBox(height: 30),
// Container(
// width: 140,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.all(Radius.circular(5)),
// gradient: LinearGradient(
// colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
// stops: const [0.0, 1.0],
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
// ),
// ),
// child: FlatButton(
// onPressed: () {
// Mop.instance.openApplet('5ea0412663cb900001d73867');
// },
// child: Text(
// '我的对账单',
// style: TextStyle(color: Colors.white),
// ),
// ),
// ),
// ],
// ),
// ),
// ),
// ),
// );
// }
// }

View File

@ -5,56 +5,56 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
flutter:
@ -71,14 +71,14 @@ packages:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
mop:
@ -87,12 +87,12 @@ packages:
path: ".."
relative: true
source: path
version: "2.33.5"
version: "2.33.3"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
sky_engine:
@ -104,58 +104,58 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.10.0"
flutter: ">=2.2.3"

View File

@ -3,7 +3,7 @@ description: Demonstrates how to use the mop plugin.
publish_to: 'none'
environment:
sdk: '>=2.1.0 <3.0.0'
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:

View File

@ -1,27 +1,27 @@
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
// // This is a basic Flutter widget test.
// //
// // To perform an interaction with a widget in your test, use the WidgetTester
// // utility that Flutter provides. For example, you can send tap and scroll
// // gestures. You can also use WidgetTester to find child widgets in the widget
// // tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
// import 'package:flutter/material.dart';
// import 'package:flutter_test/flutter_test.dart';
import 'package:mop_example/main.dart';
// import 'package:mop_example/main.dart';
void main() {
testWidgets('Verify Platform version', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// void main() {
// testWidgets('Verify Platform version', (WidgetTester tester) async {
// // Build our app and trigger a frame.
// await tester.pumpWidget(MyApp());
// Verify that platform version is retrieved.
expect(
find.byWidgetPredicate(
(Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'),
),
findsOneWidget,
);
});
}
// // Verify that platform version is retrieved.
// expect(
// find.byWidgetPredicate(
// (Widget widget) => widget is Text &&
// widget.data.startsWith('Running on:'),
// ),
// findsOneWidget,
// );
// });
// }

View File

@ -11,9 +11,9 @@ typedef ExtensionApiHandler = Future Function(dynamic params);
class Mop {
static final Mop _instance = new Mop._internal();
MethodChannel _channel;
EventChannel _mopEventChannel;
int eventId = 0;
late MethodChannel _channel;
late EventChannel _mopEventChannel;
late int eventId = 0;
List<Map<String, dynamic>> _mopEventQueye = <Map<String, dynamic>>[];
Map<String, ExtensionApiHandler> _extensionApis = {};
@ -70,11 +70,11 @@ class Mop {
/// [disablePermission] is optional.
///
Future<Map> initialize(String appkey, String secret,
{String apiServer,
String apiPrefix,
String cryptType,
bool disablePermission,
String userId,
{required String apiServer,
required String apiPrefix,
required String cryptType,
required bool disablePermission,
required String userId,
bool encryptServerData = false,
bool debug = false}) async {
final Map ret = await _channel.invokeMethod('initialize', {
@ -103,26 +103,26 @@ class Mop {
/// [cryptType] is optional. cryptType, should be MD5/SM
Future<Map> openApplet(
final String appId, {
final String path,
final String query,
final int sequence,
final String apiServer,
final String apiPrefix,
final String fingerprint,
final String cryptType,
final String scene,
required final String path,
required final String query,
required final int sequence,
required final String apiServer,
required final String apiPrefix,
required final String fingerprint,
required final String cryptType,
required final String scene,
}) async {
Map<String, Object> params = {'appId': appId};
Map param = {};
if (path != null) param["path"] = path;
if (query != null) param["query"] = query;
param["path"] = path;
param["query"] = query;
if (param.length > 0) params["params"] = param;
if (sequence != null) params["sequence"] = sequence;
if (apiServer != null) params["apiServer"] = apiServer;
if (apiPrefix != null) params["apiPrefix"] = apiPrefix;
if (fingerprint != null) params["fingerprint"] = fingerprint;
if (cryptType != null) params["cryptType"] = cryptType;
if (scene != null) param["scene"] = scene;
params["sequence"] = sequence;
params["apiServer"] = apiServer;
params["apiPrefix"] = apiPrefix;
params["fingerprint"] = fingerprint;
params["cryptType"] = cryptType;
param["scene"] = scene;
final Map ret = await _channel.invokeMethod('openApplet', params);
return ret;
}
@ -135,7 +135,7 @@ class Mop {
///
Future<Map<String, dynamic>> currentApplet() async {
final ret = await _channel.invokeMapMethod("currentApplet");
return Map<String, dynamic>.from(ret);
return Map<String, dynamic>.from(ret!);
}
///
@ -160,7 +160,7 @@ class Mop {
Future<String> sdkVersion() async {
return await _channel
.invokeMapMethod("sdkVersion")
.then((value) => value["data"]);
.then((value) => value?["data"]);
}
///
@ -178,7 +178,7 @@ class Mop {
String qrCode, String apiServer) async {
final ret = await _channel.invokeMapMethod("parseAppletInfoFromWXQrCode",
{"qrCode": qrCode, "apiServer": apiServer});
return Map<String, dynamic>.from(ret);
return Map<String, dynamic>.from(ret!);
}
///
@ -226,7 +226,7 @@ class Mop {
Future<String> getSMSign(String plainText) async {
var result =
await _channel.invokeMapMethod("smsign", {'plainText': plainText});
var data = result['data']['data'];
var data = result?['data']['data'];
print(data);
return data;
}

View File

@ -5,49 +5,49 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
flutter:
@ -64,21 +64,21 @@ packages:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
sky_engine:
@ -90,58 +90,58 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
sdks:
dart: ">=2.12.0 <3.0.0"
flutter: ">=1.10.0"
flutter: ">=2.2.3"

View File

@ -4,8 +4,8 @@ version: '2.33.3'
homepage: https://github.com/finogeeks/mop-flutter-sdk
environment:
sdk: '>=2.1.0 <3.0.0'
flutter: '^1.10.0'
sdk: '>=2.12.0 <3.0.0'
flutter: '^2.2.3'
dependencies:
flutter: