提交 6f3cb1b8 authored 作者: JarvanMo's avatar JarvanMo

support nullsafety

上级 df108699
...@@ -10,7 +10,7 @@ class AuthByQRCodePage extends StatefulWidget { ...@@ -10,7 +10,7 @@ class AuthByQRCodePage extends StatefulWidget {
class _AuthByQRCodePageState extends State<AuthByQRCodePage> { class _AuthByQRCodePageState extends State<AuthByQRCodePage> {
String _status = "status"; String _status = "status";
Uint8List _image; Uint8List? _image;
@override @override
void initState() { void initState() {
...@@ -64,7 +64,7 @@ class _AuthByQRCodePageState extends State<AuthByQRCodePage> { ...@@ -64,7 +64,7 @@ class _AuthByQRCodePageState extends State<AuthByQRCodePage> {
if (_image == null) { if (_image == null) {
return Container(); return Container();
} else { } else {
return Image.memory(_image); return Image.memory(_image!);
} }
} }
} }
...@@ -7,7 +7,7 @@ class LaunchMiniProgramPage extends StatefulWidget { ...@@ -7,7 +7,7 @@ class LaunchMiniProgramPage extends StatefulWidget {
} }
class _LaunchMiniProgramPageState extends State<LaunchMiniProgramPage> { class _LaunchMiniProgramPageState extends State<LaunchMiniProgramPage> {
String _result = "无"; String? _result = "无";
@override @override
void initState() { void initState() {
...@@ -44,7 +44,7 @@ class _LaunchMiniProgramPageState extends State<LaunchMiniProgramPage> { ...@@ -44,7 +44,7 @@ class _LaunchMiniProgramPageState extends State<LaunchMiniProgramPage> {
child: const Text("Launch MiniProgrom"), child: const Text("Launch MiniProgrom"),
), ),
const Text("响应结果;"), const Text("响应结果;"),
Text(_result) Text("$_result")
], ],
), ),
); );
......
...@@ -79,7 +79,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -79,7 +79,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("shareText"); Navigator.of(context)?.pushNamed("shareText");
}, },
child: const Text("share text")), child: const Text("share text")),
), ),
...@@ -87,7 +87,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -87,7 +87,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("shareImage"); Navigator.of(context)?.pushNamed("shareImage");
}, },
child: const Text("share image")), child: const Text("share image")),
), ),
...@@ -95,7 +95,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -95,7 +95,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("shareWebPage"); Navigator.of(context)?.pushNamed("shareWebPage");
}, },
child: const Text("share webpage")), child: const Text("share webpage")),
), ),
...@@ -103,7 +103,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -103,7 +103,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("shareMusic"); Navigator.of(context)?.pushNamed("shareMusic");
}, },
child: const Text("share music")), child: const Text("share music")),
), ),
...@@ -111,7 +111,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -111,7 +111,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("shareVideo"); Navigator.of(context)?.pushNamed("shareVideo");
}, },
child: const Text("share video")), child: const Text("share video")),
), ),
...@@ -119,7 +119,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -119,7 +119,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("shareMiniProgram"); Navigator.of(context)?.pushNamed("shareMiniProgram");
}, },
child: const Text("share mini program")), child: const Text("share mini program")),
), ),
...@@ -127,7 +127,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -127,7 +127,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("sendAuth"); Navigator.of(context)?.pushNamed("sendAuth");
}, },
child: const Text("send auth")), child: const Text("send auth")),
), ),
...@@ -135,7 +135,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -135,7 +135,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("pay"); Navigator.of(context)?.pushNamed("pay");
}, },
child: const Text("pay")), child: const Text("pay")),
), ),
...@@ -143,7 +143,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -143,7 +143,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("launchMiniProgram"); Navigator.of(context)?.pushNamed("launchMiniProgram");
}, },
child: const Text("Launch MiniProgram")), child: const Text("Launch MiniProgram")),
), ),
...@@ -151,7 +151,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -151,7 +151,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("subscribeMessage"); Navigator.of(context)?.pushNamed("subscribeMessage");
}, },
child: const Text("SubscribeMessage")), child: const Text("SubscribeMessage")),
), ),
...@@ -159,7 +159,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -159,7 +159,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("AuthByQRCode"); Navigator.of(context)?.pushNamed("AuthByQRCode");
}, },
child: const Text("AuthByQRCode")), child: const Text("AuthByQRCode")),
), ),
...@@ -167,7 +167,7 @@ class ShareSelectorPage extends StatelessWidget { ...@@ -167,7 +167,7 @@ class ShareSelectorPage extends StatelessWidget {
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: new OutlineButton( child: new OutlineButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushNamed("AutoDeduct"); Navigator.of(context)?.pushNamed("AutoDeduct");
}, },
child: const Text("SignAuto-deduct")), child: const Text("SignAuto-deduct")),
), ),
......
...@@ -7,7 +7,7 @@ class SendAuthPage extends StatefulWidget { ...@@ -7,7 +7,7 @@ class SendAuthPage extends StatefulWidget {
} }
class _SendAuthPageState extends State<SendAuthPage> { class _SendAuthPageState extends State<SendAuthPage> {
String _result = "无"; String? _result = "无";
@override @override
void initState() { void initState() {
...@@ -45,7 +45,7 @@ class _SendAuthPageState extends State<SendAuthPage> { ...@@ -45,7 +45,7 @@ class _SendAuthPageState extends State<SendAuthPage> {
child: const Text("send auth"), child: const Text("send auth"),
), ),
const Text("响应结果;"), const Text("响应结果;"),
Text(_result) Text("$_result")
], ],
), ),
); );
......
...@@ -14,8 +14,8 @@ class _ShareImagePageState extends State<ShareImagePage> { ...@@ -14,8 +14,8 @@ class _ShareImagePageState extends State<ShareImagePage> {
String _response = ""; String _response = "";
WeChatImage source; WeChatImage? source;
WeChatImage thumbnail; WeChatImage? thumbnail;
@override @override
void initState() { void initState() {
...@@ -72,7 +72,10 @@ class _ShareImagePageState extends State<ShareImagePage> { ...@@ -72,7 +72,10 @@ class _ShareImagePageState extends State<ShareImagePage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.SESSION, value: WeChatScene.SESSION,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("会话") const Text("会话")
], ],
), ),
...@@ -81,7 +84,10 @@ class _ShareImagePageState extends State<ShareImagePage> { ...@@ -81,7 +84,10 @@ class _ShareImagePageState extends State<ShareImagePage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.TIMELINE, value: WeChatScene.TIMELINE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("朋友圈") const Text("朋友圈")
], ],
), ),
...@@ -90,7 +96,10 @@ class _ShareImagePageState extends State<ShareImagePage> { ...@@ -90,7 +96,10 @@ class _ShareImagePageState extends State<ShareImagePage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.FAVORITE, value: WeChatScene.FAVORITE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("收藏") const Text("收藏")
], ],
) )
...@@ -104,7 +113,7 @@ class _ShareImagePageState extends State<ShareImagePage> { ...@@ -104,7 +113,7 @@ class _ShareImagePageState extends State<ShareImagePage> {
} }
void _shareImage() { void _shareImage() {
shareToWeChat(WeChatShareImageModel(source, thumbnail: thumbnail)); shareToWeChat(WeChatShareImageModel(source!, thumbnail: thumbnail));
} }
void handleRadioValueChanged(WeChatScene scene) { void handleRadioValueChanged(WeChatScene scene) {
......
...@@ -85,7 +85,10 @@ class _ShareMusicPageState extends State<ShareMusicPage> { ...@@ -85,7 +85,10 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.SESSION, value: WeChatScene.SESSION,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("会话") const Text("会话")
], ],
), ),
...@@ -94,7 +97,10 @@ class _ShareMusicPageState extends State<ShareMusicPage> { ...@@ -94,7 +97,10 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.TIMELINE, value: WeChatScene.TIMELINE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("朋友圈") const Text("朋友圈")
], ],
), ),
...@@ -103,7 +109,10 @@ class _ShareMusicPageState extends State<ShareMusicPage> { ...@@ -103,7 +109,10 @@ class _ShareMusicPageState extends State<ShareMusicPage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.FAVORITE, value: WeChatScene.FAVORITE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("收藏") const Text("收藏")
], ],
) )
......
...@@ -48,7 +48,10 @@ class _ShareTextPageState extends State<ShareTextPage> { ...@@ -48,7 +48,10 @@ class _ShareTextPageState extends State<ShareTextPage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.SESSION, value: WeChatScene.SESSION,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("会话") const Text("会话")
], ],
), ),
...@@ -57,7 +60,10 @@ class _ShareTextPageState extends State<ShareTextPage> { ...@@ -57,7 +60,10 @@ class _ShareTextPageState extends State<ShareTextPage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.TIMELINE, value: WeChatScene.TIMELINE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("朋友圈") const Text("朋友圈")
], ],
), ),
...@@ -66,7 +72,10 @@ class _ShareTextPageState extends State<ShareTextPage> { ...@@ -66,7 +72,10 @@ class _ShareTextPageState extends State<ShareTextPage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.FAVORITE, value: WeChatScene.FAVORITE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("收藏") const Text("收藏")
], ],
) )
......
...@@ -84,7 +84,10 @@ class _ShareMusicPageState extends State<ShareVideoPage> { ...@@ -84,7 +84,10 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.SESSION, value: WeChatScene.SESSION,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("会话") const Text("会话")
], ],
), ),
...@@ -93,7 +96,10 @@ class _ShareMusicPageState extends State<ShareVideoPage> { ...@@ -93,7 +96,10 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.TIMELINE, value: WeChatScene.TIMELINE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("朋友圈") const Text("朋友圈")
], ],
), ),
...@@ -102,7 +108,10 @@ class _ShareMusicPageState extends State<ShareVideoPage> { ...@@ -102,7 +108,10 @@ class _ShareMusicPageState extends State<ShareVideoPage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.FAVORITE, value: WeChatScene.FAVORITE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("收藏") const Text("收藏")
], ],
) )
......
...@@ -68,7 +68,10 @@ class ShareWebPagePageState extends State<ShareWebPagePage> { ...@@ -68,7 +68,10 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.SESSION, value: WeChatScene.SESSION,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("会话") const Text("会话")
], ],
), ),
...@@ -77,7 +80,10 @@ class ShareWebPagePageState extends State<ShareWebPagePage> { ...@@ -77,7 +80,10 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.TIMELINE, value: WeChatScene.TIMELINE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("朋友圈") const Text("朋友圈")
], ],
), ),
...@@ -86,7 +92,10 @@ class ShareWebPagePageState extends State<ShareWebPagePage> { ...@@ -86,7 +92,10 @@ class ShareWebPagePageState extends State<ShareWebPagePage> {
new Radio<WeChatScene>( new Radio<WeChatScene>(
value: WeChatScene.FAVORITE, value: WeChatScene.FAVORITE,
groupValue: scene, groupValue: scene,
onChanged: handleRadioValueChanged), onChanged: (v){
if(v!=null)
handleRadioValueChanged(v);
}),
const Text("收藏") const Text("收藏")
], ],
) )
......
...@@ -83,8 +83,8 @@ class _SignAutoDeductPageState extends State<SignAutoDeductPage> { ...@@ -83,8 +83,8 @@ class _SignAutoDeductPageState extends State<SignAutoDeductPage> {
} }
Widget _buildTextField({ Widget _buildTextField({
String title, String? title,
TextEditingController textEditController, TextEditingController? textEditController,
}) { }) {
return TextField( return TextField(
decoration: InputDecoration( decoration: InputDecoration(
......
...@@ -57,8 +57,8 @@ class _SubscribeMessagePageState extends State<SubscribeMessagePage> { ...@@ -57,8 +57,8 @@ class _SubscribeMessagePageState extends State<SubscribeMessagePage> {
} }
Widget _buildTextField({ Widget _buildTextField({
String title, String? title,
TextEditingController textEditController, TextEditingController? textEditController,
}) { }) {
return TextField( return TextField(
decoration: InputDecoration( decoration: InputDecoration(
......
...@@ -5,58 +5,58 @@ packages: ...@@ -5,58 +5,58 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0-nullsafety.1" version: "2.5.0-nullsafety.3"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.1" version: "2.1.0-nullsafety.3"
characters: characters:
dependency: "direct main" dependency: "direct main"
description: description:
name: characters name: characters
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.3" version: "1.1.0-nullsafety.5"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0-nullsafety.3"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0-nullsafety.3"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0-nullsafety.3" version: "1.15.0-nullsafety.5"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
name: cupertino_icons name: cupertino_icons
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "1.0.1+1"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0-nullsafety.3"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
...@@ -73,28 +73,28 @@ packages: ...@@ -73,28 +73,28 @@ packages:
path: ".." path: ".."
relative: true relative: true
source: path source: path
version: "2.4.2" version: "3.0.0-nullsafety.1"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.10-nullsafety.1" version: "0.12.10-nullsafety.3"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0-nullsafety.6"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety.1" version: "1.8.0-nullsafety.3"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
...@@ -104,58 +104,58 @@ packages: ...@@ -104,58 +104,58 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety.2" version: "1.8.0-nullsafety.4"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.1" version: "1.10.0-nullsafety.6"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.1" version: "2.1.0-nullsafety.3"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0-nullsafety.3"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0-nullsafety.3"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19-nullsafety.2" version: "0.2.19-nullsafety.6"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0-nullsafety.5"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.3" version: "2.1.0-nullsafety.5"
sdks: sdks:
dart: ">=2.10.0-110 <2.11.0" dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.12.0 <2.0.0" flutter: ">=1.12.0 <2.0.0"
...@@ -3,7 +3,7 @@ description: Demonstrates how to use the fluwx plugin. ...@@ -3,7 +3,7 @@ description: Demonstrates how to use the fluwx plugin.
publish_to: 'none' publish_to: 'none'
environment: environment:
sdk: ">=2.1.0 <3.0.0" sdk: ">=2.12.0-0 <3.0.0"
dependencies: dependencies:
flutter: flutter:
...@@ -12,7 +12,7 @@ dependencies: ...@@ -12,7 +12,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2 cupertino_icons: ^1.0.1+1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
......
...@@ -16,12 +16,12 @@ void main() { ...@@ -16,12 +16,12 @@ void main() {
await tester.pumpWidget(MyApp()); await tester.pumpWidget(MyApp());
// Verify that platform version is retrieved. // Verify that platform version is retrieved.
expect( // expect(
find.byWidgetPredicate( // find.byWidgetPredicate(
(Widget widget) => widget is Text && // (Widget widget) => widget is Text &&
widget.data.startsWith('Running on:'), // widget.data.startsWith('Running on:'),
), // ),
findsOneWidget, // findsOneWidget,
); // );
}); });
} }
...@@ -62,14 +62,16 @@ Future<bool> openWeChatApp() async { ...@@ -62,14 +62,16 @@ Future<bool> openWeChatApp() async {
///if [doOnAndroid] is true, fluwx will register WXApi on Android. ///if [doOnAndroid] is true, fluwx will register WXApi on Android.
/// [universalLink] is required if you want to register on iOS. /// [universalLink] is required if you want to register on iOS.
Future<bool> registerWxApi( Future<bool> registerWxApi(
{String appId, {required String appId,
bool doOnIOS: true, bool doOnIOS: true,
bool doOnAndroid: true, bool doOnAndroid: true,
String universalLink}) async { String? universalLink}) async {
if (doOnIOS && Platform.isIOS) { if (doOnIOS && Platform.isIOS) {
if (universalLink.trim().isEmpty || !universalLink.startsWith("https")) { if (universalLink == null ||
universalLink.trim().isEmpty ||
!universalLink.startsWith("https")) {
throw ArgumentError.value(universalLink, throw ArgumentError.value(universalLink,
"your universal link is illegal, see https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/iOS.html for detail"); "you're trying to use illegal universal link , see https://developers.weixin.qq.com/doc/oplatform/Mobile_App/Access_Guide/iOS.html for detail");
} }
} }
return await _channel.invokeMethod("registerApp", { return await _channel.invokeMethod("registerApp", {
...@@ -85,8 +87,11 @@ Future<bool> registerWxApi( ...@@ -85,8 +87,11 @@ Future<bool> registerWxApi(
///see [_shareModelMethodMapper] for detail. ///see [_shareModelMethodMapper] for detail.
Future<bool> shareToWeChat(WeChatShareBaseModel model) async { Future<bool> shareToWeChat(WeChatShareBaseModel model) async {
if (_shareModelMethodMapper.containsKey(model.runtimeType)) { if (_shareModelMethodMapper.containsKey(model.runtimeType)) {
var methodChannel = _shareModelMethodMapper[model.runtimeType];
if(methodChannel == null)
throw ArgumentError.value("${model.runtimeType} method channel not found");
return await _channel.invokeMethod( return await _channel.invokeMethod(
_shareModelMethodMapper[model.runtimeType], model.toMap()); methodChannel , model.toMap());
} else { } else {
return Future.error("no method mapper found[${model.runtimeType}]"); return Future.error("no method mapper found[${model.runtimeType}]");
} }
...@@ -99,8 +104,8 @@ Future<bool> shareToWeChat(WeChatShareBaseModel model) async { ...@@ -99,8 +104,8 @@ Future<bool> shareToWeChat(WeChatShareBaseModel model) async {
/// Once AuthCode got, you need to request Access_Token /// Once AuthCode got, you need to request Access_Token
/// For more information please visit: /// For more information please visit:
/// * https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419317851&token= /// * https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419317851&token=
Future<bool> sendWeChatAuth({@required String scope, String state}) async { Future<bool> sendWeChatAuth({required String scope, String state="state"}) async {
assert(scope != null && scope.trim().isNotEmpty); assert(scope.trim().isNotEmpty);
return await _channel return await _channel
.invokeMethod("sendAuth", {"scope": scope, "state": state}); .invokeMethod("sendAuth", {"scope": scope, "state": state});
} }
...@@ -108,10 +113,10 @@ Future<bool> sendWeChatAuth({@required String scope, String state}) async { ...@@ -108,10 +113,10 @@ Future<bool> sendWeChatAuth({@required String scope, String state}) async {
/// open mini-program /// open mini-program
/// see [WXMiniProgramType] /// see [WXMiniProgramType]
Future<bool> launchWeChatMiniProgram( Future<bool> launchWeChatMiniProgram(
{@required String username, {required String username,
String path, String? path,
WXMiniProgramType miniProgramType = WXMiniProgramType.RELEASE}) async { WXMiniProgramType miniProgramType = WXMiniProgramType.RELEASE}) async {
assert(username != null && username.trim().isNotEmpty); assert(username.trim().isNotEmpty);
return await _channel.invokeMethod("launchMiniProgram", { return await _channel.invokeMethod("launchMiniProgram", {
"userName": username, "userName": username,
"path": path, "path": path,
...@@ -123,15 +128,15 @@ Future<bool> launchWeChatMiniProgram( ...@@ -123,15 +128,15 @@ Future<bool> launchWeChatMiniProgram(
/// Read the official document for more detail. /// Read the official document for more detail.
/// [timeStamp] is int because [timeStamp] will be mapped to Unit32. /// [timeStamp] is int because [timeStamp] will be mapped to Unit32.
Future<bool> payWithWeChat( Future<bool> payWithWeChat(
{@required String appId, {required String appId,
@required String partnerId, required String partnerId,
@required String prepayId, required String prepayId,
@required String packageValue, required String packageValue,
@required String nonceStr, required String nonceStr,
@required int timeStamp, required int timeStamp,
@required String sign, required String sign,
String signType, String? signType,
String extData}) async { String? extData}) async {
return await _channel.invokeMethod("payWithFluwx", { return await _channel.invokeMethod("payWithFluwx", {
"appId": appId, "appId": appId,
"partnerId": partnerId, "partnerId": partnerId,
...@@ -147,7 +152,7 @@ Future<bool> payWithWeChat( ...@@ -147,7 +152,7 @@ Future<bool> payWithWeChat(
/// request Hong Kong Wallet payment with WeChat. /// request Hong Kong Wallet payment with WeChat.
/// Read the official document for more detail. /// Read the official document for more detail.
Future<bool> payWithWeChatHongKongWallet({@required String prepayId}) async { Future<bool> payWithWeChatHongKongWallet({required String prepayId}) async {
return await _channel.invokeMethod("payWithHongKongWallet", { return await _channel.invokeMethod("payWithHongKongWallet", {
"prepayId": prepayId, "prepayId": prepayId,
}); });
...@@ -155,10 +160,10 @@ Future<bool> payWithWeChatHongKongWallet({@required String prepayId}) async { ...@@ -155,10 +160,10 @@ Future<bool> payWithWeChatHongKongWallet({@required String prepayId}) async {
/// subscribe WeChat message /// subscribe WeChat message
Future<bool> subscribeWeChatMsg({ Future<bool> subscribeWeChatMsg({
@required String appId, required String appId,
@required int scene, required int scene,
@required String templateId, required String templateId,
String reserved, String? reserved,
}) async { }) async {
return await _channel.invokeMethod( return await _channel.invokeMethod(
"subscribeMsg", "subscribeMsg",
...@@ -173,16 +178,16 @@ Future<bool> subscribeWeChatMsg({ ...@@ -173,16 +178,16 @@ Future<bool> subscribeWeChatMsg({
/// please read official docs. /// please read official docs.
Future<bool> autoDeDuctWeChat( Future<bool> autoDeDuctWeChat(
{@required String appId, {required String appId,
@required String mchId, required String mchId,
@required String planId, required String planId,
@required String contractCode, required String contractCode,
@required String requestSerial, required String requestSerial,
@required String contractDisplayAccount, required String contractDisplayAccount,
@required String notifyUrl, required String notifyUrl,
@required String version, required String version,
@required String sign, required String sign,
@required String timestamp, required String timestamp,
String returnApp = '3', String returnApp = '3',
int businessType = 12}) async { int businessType = 12}) async {
return await _channel.invokeMethod("autoDeduct", { return await _channel.invokeMethod("autoDeduct", {
...@@ -207,17 +212,17 @@ Future<bool> autoDeDuctWeChat( ...@@ -207,17 +212,17 @@ Future<bool> autoDeDuctWeChat(
/// [schemeData] only works on iOS /// [schemeData] only works on iOS
/// see * https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=215238808828h4XN&token=&lang=zh_CN /// see * https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=215238808828h4XN&token=&lang=zh_CN
Future<bool> authWeChatByQRCode( Future<bool> authWeChatByQRCode(
{@required String appId, {required String appId,
@required String scope, required String scope,
@required String nonceStr, required String nonceStr,
@required String timeStamp, required String timeStamp,
@required String signature, required String signature,
String schemeData}) async { String? schemeData}) async {
assert(appId != null && appId.isNotEmpty); assert(appId.isNotEmpty);
assert(scope != null && scope.isNotEmpty); assert(scope.isNotEmpty);
assert(nonceStr != null && nonceStr.isNotEmpty); assert(nonceStr.isNotEmpty);
assert(timeStamp != null && timeStamp.isNotEmpty); assert(timeStamp.isNotEmpty);
assert(signature != null && signature.isNotEmpty); assert(signature.isNotEmpty);
return await _channel.invokeMethod("authByQRCode", { return await _channel.invokeMethod("authByQRCode", {
"appId": appId, "appId": appId,
...@@ -243,7 +248,7 @@ Future _methodHandler(MethodCall methodCall) { ...@@ -243,7 +248,7 @@ Future _methodHandler(MethodCall methodCall) {
///IOS only ///IOS only
Future<bool> authWeChatByPhoneLogin( Future<bool> authWeChatByPhoneLogin(
{@required String scope, String state}) async { {required String scope, String state="state"}) async {
return await _channel return await _channel
.invokeMethod("authByPhoneLogin", {"scope": scope, "state": state}); .invokeMethod("authByPhoneLogin", {"scope": scope, "state": state});
} }
...@@ -53,8 +53,14 @@ class BaseWeChatResponse { ...@@ -53,8 +53,14 @@ class BaseWeChatResponse {
BaseWeChatResponse._(this.errCode, this.errStr); BaseWeChatResponse._(this.errCode, this.errStr);
/// create response from response pool /// create response from response pool
factory BaseWeChatResponse.create(String name, Map argument) => factory BaseWeChatResponse.create(String name, Map argument) {
_nameAndResponseMapper[name](argument); var result = _nameAndResponseMapper[name];
if(result == null){
throw ArgumentError("Can't found instance of $name");
}
return result(argument);
}
} }
class WeChatShareResponse extends BaseWeChatResponse { class WeChatShareResponse extends BaseWeChatResponse {
...@@ -67,10 +73,10 @@ class WeChatShareResponse extends BaseWeChatResponse { ...@@ -67,10 +73,10 @@ class WeChatShareResponse extends BaseWeChatResponse {
class WeChatAuthResponse extends BaseWeChatResponse { class WeChatAuthResponse extends BaseWeChatResponse {
final int type; final int type;
final String country; final String? country;
final String lang; final String? lang;
final String code; final String? code;
final String state; final String? state;
WeChatAuthResponse.fromMap(Map map) WeChatAuthResponse.fromMap(Map map)
: type = map["type"], : type = map["type"],
...@@ -101,8 +107,8 @@ class WeChatAuthResponse extends BaseWeChatResponse { ...@@ -101,8 +107,8 @@ class WeChatAuthResponse extends BaseWeChatResponse {
} }
class WeChatLaunchMiniProgramResponse extends BaseWeChatResponse { class WeChatLaunchMiniProgramResponse extends BaseWeChatResponse {
final int type; final int? type;
final String extMsg; final String? extMsg;
WeChatLaunchMiniProgramResponse.fromMap(Map map) WeChatLaunchMiniProgramResponse.fromMap(Map map)
: type = map["type"], : type = map["type"],
...@@ -121,10 +127,10 @@ class WeChatPaymentResponse extends BaseWeChatResponse { ...@@ -121,10 +127,10 @@ class WeChatPaymentResponse extends BaseWeChatResponse {
} }
class WeChatSubscribeMsgResponse extends BaseWeChatResponse { class WeChatSubscribeMsgResponse extends BaseWeChatResponse {
final String openid; final String? openid;
final String templateId; final String? templateId;
final String action; final String? action;
final String reserved; final String? reserved;
final int scene; final int scene;
WeChatSubscribeMsgResponse.fromMap(Map map) WeChatSubscribeMsgResponse.fromMap(Map map)
...@@ -137,9 +143,9 @@ class WeChatSubscribeMsgResponse extends BaseWeChatResponse { ...@@ -137,9 +143,9 @@ class WeChatSubscribeMsgResponse extends BaseWeChatResponse {
} }
class WeChatOpenBusinessWebviewResponse extends BaseWeChatResponse { class WeChatOpenBusinessWebviewResponse extends BaseWeChatResponse {
final int type; final int? type;
final int errCode; final int errCode;
final int businessType; final int? businessType;
final String resultInfo; final String resultInfo;
WeChatOpenBusinessWebviewResponse.fromMap(Map map) WeChatOpenBusinessWebviewResponse.fromMap(Map map)
...@@ -151,8 +157,8 @@ class WeChatOpenBusinessWebviewResponse extends BaseWeChatResponse { ...@@ -151,8 +157,8 @@ class WeChatOpenBusinessWebviewResponse extends BaseWeChatResponse {
} }
class WeChatAuthByQRCodeFinishedResponse extends BaseWeChatResponse { class WeChatAuthByQRCodeFinishedResponse extends BaseWeChatResponse {
final String authCode; final String? authCode;
final AuthByQRCodeErrorCode qrCodeErrorCode; final AuthByQRCodeErrorCode? qrCodeErrorCode;
WeChatAuthByQRCodeFinishedResponse.fromMap(Map map) WeChatAuthByQRCodeFinishedResponse.fromMap(Map map)
: authCode = map["authCode"], : authCode = map["authCode"],
...@@ -177,7 +183,7 @@ class WeChatQRCodeScannedResponse extends BaseWeChatResponse { ...@@ -177,7 +183,7 @@ class WeChatQRCodeScannedResponse extends BaseWeChatResponse {
// 获取微信打开App时携带的参数 // 获取微信打开App时携带的参数
class WeChatShowMessageFromWXRequest extends BaseWeChatResponse { class WeChatShowMessageFromWXRequest extends BaseWeChatResponse {
final String extMsg; final String? extMsg;
WeChatShowMessageFromWXRequest.fromMap(Map map) WeChatShowMessageFromWXRequest.fromMap(Map map)
: extMsg = map["extMsg"], : extMsg = map["extMsg"],
......
...@@ -39,21 +39,20 @@ mixin WeChatShareBaseModel { ...@@ -39,21 +39,20 @@ mixin WeChatShareBaseModel {
class WeChatShareTextModel implements WeChatShareBaseModel { class WeChatShareTextModel implements WeChatShareBaseModel {
final String source; final String source;
final WeChatScene scene; final WeChatScene scene;
final String messageExt; final String? messageExt;
final String messageAction; final String? messageAction;
final String mediaTagName; final String? mediaTagName;
final String title; final String? title;
final String description; final String? description;
WeChatShareTextModel(this.source, WeChatShareTextModel(this.source,
{this.scene = WeChatScene.SESSION, {this.scene = WeChatScene.SESSION,
this.mediaTagName, this.mediaTagName,
this.messageAction, this.messageAction,
this.messageExt, this.messageExt,
String description, String? description,
String title}) String? title})
: assert(scene != null), :this.title = title ?? source,
this.title = title ?? source,
this.description = description ?? source; this.description = description ?? source;
@override @override
...@@ -78,20 +77,20 @@ class WeChatShareMiniProgramModel implements WeChatShareBaseModel { ...@@ -78,20 +77,20 @@ class WeChatShareMiniProgramModel implements WeChatShareBaseModel {
final WXMiniProgramType miniProgramType; final WXMiniProgramType miniProgramType;
final String userName; final String userName;
final String path; final String path;
final WeChatImage hdImagePath; final WeChatImage? hdImagePath;
final String title; final String? title;
final String description; final String? description;
final WeChatImage thumbnail; final WeChatImage? thumbnail;
final bool withShareTicket; final bool withShareTicket;
final String messageExt; final String? messageExt;
final String messageAction; final String? messageAction;
final String mediaTagName; final String? mediaTagName;
final bool compressThumbnail; final bool compressThumbnail;
WeChatShareMiniProgramModel( WeChatShareMiniProgramModel(
{@required this.webPageUrl, {required this.webPageUrl,
this.miniProgramType = WXMiniProgramType.RELEASE, this.miniProgramType = WXMiniProgramType.RELEASE,
@required this.userName, required this.userName,
this.path: "/", this.path: "/",
this.title, this.title,
this.description, this.description,
...@@ -102,10 +101,10 @@ class WeChatShareMiniProgramModel implements WeChatShareBaseModel { ...@@ -102,10 +101,10 @@ class WeChatShareMiniProgramModel implements WeChatShareBaseModel {
this.messageAction, this.messageAction,
this.messageExt, this.messageExt,
this.compressThumbnail = true}) this.compressThumbnail = true})
: assert(miniProgramType != null), :
assert(webPageUrl != null && webPageUrl.isNotEmpty), assert(webPageUrl.isNotEmpty),
assert(userName != null && userName.isNotEmpty), assert(userName.isNotEmpty),
assert(path != null && path.isNotEmpty); assert(path.isNotEmpty);
@override @override
Map toMap() { Map toMap() {
...@@ -132,16 +131,16 @@ class WeChatShareMiniProgramModel implements WeChatShareBaseModel { ...@@ -132,16 +131,16 @@ class WeChatShareMiniProgramModel implements WeChatShareBaseModel {
class WeChatShareImageModel implements WeChatShareBaseModel { class WeChatShareImageModel implements WeChatShareBaseModel {
final WeChatImage source; final WeChatImage source;
final WeChatImage thumbnail; final WeChatImage thumbnail;
final String title; final String? title;
final WeChatScene scene; final WeChatScene scene;
final String description; final String? description;
final String messageExt; final String? messageExt;
final String messageAction; final String? messageAction;
final String mediaTagName; final String? mediaTagName;
final bool compressThumbnail; final bool compressThumbnail;
WeChatShareImageModel(this.source, WeChatShareImageModel(this.source,
{WeChatImage thumbnail, {WeChatImage? thumbnail,
this.title, this.title,
this.scene = WeChatScene.SESSION, this.scene = WeChatScene.SESSION,
this.description, this.description,
...@@ -149,9 +148,7 @@ class WeChatShareImageModel implements WeChatShareBaseModel { ...@@ -149,9 +148,7 @@ class WeChatShareImageModel implements WeChatShareBaseModel {
this.messageAction, this.messageAction,
this.messageExt, this.messageExt,
this.compressThumbnail = true}) this.compressThumbnail = true})
: assert(source != null), :this.thumbnail = thumbnail ?? source;
assert(scene != null),
this.thumbnail = thumbnail ?? source;
@override @override
Map toMap() { Map toMap() {
...@@ -171,17 +168,17 @@ class WeChatShareImageModel implements WeChatShareBaseModel { ...@@ -171,17 +168,17 @@ class WeChatShareImageModel implements WeChatShareBaseModel {
/// if [musicUrl] and [musicLowBandUrl] are both provided, /// if [musicUrl] and [musicLowBandUrl] are both provided,
/// only [musicUrl] will be used. /// only [musicUrl] will be used.
class WeChatShareMusicModel implements WeChatShareBaseModel { class WeChatShareMusicModel implements WeChatShareBaseModel {
final String musicUrl; final String? musicUrl;
final String musicDataUrl; final String? musicDataUrl;
final String musicLowBandUrl; final String? musicLowBandUrl;
final String musicLowBandDataUrl; final String? musicLowBandDataUrl;
final WeChatImage thumbnail; final WeChatImage? thumbnail;
final String title; final String? title;
final String description; final String? description;
final WeChatScene scene; final WeChatScene scene;
final String messageExt; final String? messageExt;
final String messageAction; final String? messageAction;
final String mediaTagName; final String? mediaTagName;
final bool compressThumbnail; final bool compressThumbnail;
WeChatShareMusicModel( WeChatShareMusicModel(
...@@ -197,8 +194,7 @@ class WeChatShareMusicModel implements WeChatShareBaseModel { ...@@ -197,8 +194,7 @@ class WeChatShareMusicModel implements WeChatShareBaseModel {
this.messageExt, this.messageExt,
this.scene = WeChatScene.SESSION, this.scene = WeChatScene.SESSION,
this.compressThumbnail = true}) this.compressThumbnail = true})
: assert(musicUrl != null || musicLowBandUrl != null), : assert(musicUrl != null || musicLowBandUrl != null);
assert(scene != null);
@override @override
Map toMap() { Map toMap() {
...@@ -221,15 +217,15 @@ class WeChatShareMusicModel implements WeChatShareBaseModel { ...@@ -221,15 +217,15 @@ class WeChatShareMusicModel implements WeChatShareBaseModel {
/// if [videoUrl] and [videoLowBandUrl] are both provided, /// if [videoUrl] and [videoLowBandUrl] are both provided,
/// only [videoUrl] will be used. /// only [videoUrl] will be used.
class WeChatShareVideoModel implements WeChatShareBaseModel { class WeChatShareVideoModel implements WeChatShareBaseModel {
final String videoUrl; final String? videoUrl;
final String videoLowBandUrl; final String? videoLowBandUrl;
final WeChatImage thumbnail; final WeChatImage? thumbnail;
final String title; final String? title;
final String description; final String? description;
final WeChatScene scene; final WeChatScene scene;
final String messageExt; final String? messageExt;
final String messageAction; final String? messageAction;
final String mediaTagName; final String? mediaTagName;
final bool compressThumbnail; final bool compressThumbnail;
WeChatShareVideoModel( WeChatShareVideoModel(
...@@ -244,8 +240,7 @@ class WeChatShareVideoModel implements WeChatShareBaseModel { ...@@ -244,8 +240,7 @@ class WeChatShareVideoModel implements WeChatShareBaseModel {
this.messageExt, this.messageExt,
this.compressThumbnail = true}) this.compressThumbnail = true})
: assert(videoUrl != null || videoLowBandUrl != null), : assert(videoUrl != null || videoLowBandUrl != null),
assert(thumbnail != null), assert(thumbnail != null);
assert(scene != null);
@override @override
Map toMap() { Map toMap() {
...@@ -267,26 +262,25 @@ class WeChatShareVideoModel implements WeChatShareBaseModel { ...@@ -267,26 +262,25 @@ class WeChatShareVideoModel implements WeChatShareBaseModel {
///[thumbnail] logo of your website ///[thumbnail] logo of your website
class WeChatShareWebPageModel implements WeChatShareBaseModel { class WeChatShareWebPageModel implements WeChatShareBaseModel {
final String webPage; final String webPage;
final WeChatImage thumbnail; final WeChatImage? thumbnail;
final String title; final String title;
final String description; final String description;
final WeChatScene scene; final WeChatScene scene;
final String messageExt; final String? messageExt;
final String messageAction; final String? messageAction;
final String mediaTagName; final String? mediaTagName;
final bool compressThumbnail; final bool compressThumbnail;
WeChatShareWebPageModel(this.webPage, WeChatShareWebPageModel(this.webPage,
{this.title: "", {this.title: "",
String description, String? description,
this.thumbnail, this.thumbnail,
this.scene = WeChatScene.SESSION, this.scene = WeChatScene.SESSION,
this.mediaTagName, this.mediaTagName,
this.messageAction, this.messageAction,
this.messageExt, this.messageExt,
this.compressThumbnail = true}) this.compressThumbnail = true})
: assert(webPage != null && webPage.isNotEmpty), : assert(webPage.isNotEmpty),
assert(scene != null),
this.description = description ?? webPage; this.description = description ?? webPage;
@override @override
...@@ -309,13 +303,13 @@ class WeChatShareWebPageModel implements WeChatShareBaseModel { ...@@ -309,13 +303,13 @@ class WeChatShareWebPageModel implements WeChatShareBaseModel {
/// send files to WeChat /// send files to WeChat
class WeChatShareFileModel implements WeChatShareBaseModel { class WeChatShareFileModel implements WeChatShareBaseModel {
final WeChatFile source; final WeChatFile source;
final WeChatImage thumbnail; final WeChatImage? thumbnail;
final String title; final String title;
final String description; final String description;
final WeChatScene scene; final WeChatScene scene;
final String messageExt; final String? messageExt;
final String messageAction; final String? messageAction;
final String mediaTagName; final String? mediaTagName;
final bool compressThumbnail; final bool compressThumbnail;
WeChatShareFileModel(this.source, WeChatShareFileModel(this.source,
...@@ -326,9 +320,7 @@ class WeChatShareFileModel implements WeChatShareBaseModel { ...@@ -326,9 +320,7 @@ class WeChatShareFileModel implements WeChatShareBaseModel {
this.mediaTagName, this.mediaTagName,
this.messageAction, this.messageAction,
this.messageExt, this.messageExt,
this.compressThumbnail = true}) this.compressThumbnail = true});
: assert(source != null),
assert(scene != null);
@override @override
Map toMap() { Map toMap() {
......
...@@ -42,29 +42,27 @@ class WeChatFile { ...@@ -42,29 +42,27 @@ class WeChatFile {
final String suffix; final String suffix;
/// [source] must begin with http or https /// [source] must begin with http or https
WeChatFile.network(String source, {String suffix}) WeChatFile.network(String source, {String? suffix})
: assert(source != null && source.startsWith("http")), : assert(source.startsWith("http")),
this.source = source, this.source = source,
this.schema = FileSchema.NETWORK, this.schema = FileSchema.NETWORK,
this.suffix = source.readSuffix(suffix, defaultSuffixTxt); this.suffix = source.readSuffix(suffix, defaultSuffixTxt);
///[source] path of the image, like '/asset/image.pdf?package=flutter', ///[source] path of the image, like '/asset/image.pdf?package=flutter',
///the query param package in [source] only available when you want to specify the package of image ///the query param package in [source] only available when you want to specify the package of image
WeChatFile.asset(String source, {String suffix}) WeChatFile.asset(String source, {String? suffix})
: assert(source != null && source.trim().isNotEmpty), : assert(source.trim().isNotEmpty),
this.source = source, this.source = source,
this.schema = FileSchema.ASSET, this.schema = FileSchema.ASSET,
this.suffix = source.readSuffix(suffix, defaultSuffixTxt); this.suffix = source.readSuffix(suffix, defaultSuffixTxt);
WeChatFile.file(File source, {String suffix = defaultSuffixTxt}) WeChatFile.file(File source, {String suffix = defaultSuffixTxt})
: assert(source != null), :this.source = source.path,
this.source = source.path,
this.schema = FileSchema.FILE, this.schema = FileSchema.FILE,
this.suffix = source.path.readSuffix(suffix, defaultSuffixTxt); this.suffix = source.path.readSuffix(suffix, defaultSuffixTxt);
WeChatFile.binary(Uint8List source, {String suffix = defaultSuffixTxt}) WeChatFile.binary(Uint8List source, {String suffix = defaultSuffixTxt})
: assert(source != null), : assert(suffix.trim().isNotEmpty),
assert(suffix != null && suffix.trim().isNotEmpty),
this.source = source, this.source = source,
this.schema = FileSchema.BINARY, this.schema = FileSchema.BINARY,
this.suffix = suffix; this.suffix = suffix;
...@@ -89,8 +87,9 @@ extension _FileSuffix on String { ...@@ -89,8 +87,9 @@ extension _FileSuffix on String {
/// returns [suffix] if [suffix] not blank. /// returns [suffix] if [suffix] not blank.
/// If [suffix] is blank, then try to read from url /// If [suffix] is blank, then try to read from url
/// if suffix in url not found, then return jpg as default. /// if suffix in url not found, then return jpg as default.
String readSuffix(String suffix, String defaultSuffix) { String readSuffix(String? suffix, String defaultSuffix) {
if (suffix != null && suffix.trim().isNotEmpty) {
if (suffix!=null && suffix.trim().isNotEmpty) {
if (suffix.startsWith(".")) { if (suffix.startsWith(".")) {
return suffix; return suffix;
} else { } else {
......
...@@ -5,51 +5,51 @@ packages: ...@@ -5,51 +5,51 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.5.0-nullsafety.1" version: "2.5.0-nullsafety.3"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.1" version: "2.1.0-nullsafety.3"
characters: characters:
dependency: transitive dependency: transitive
description: description:
name: characters name: characters
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.3" version: "1.1.0-nullsafety.5"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
name: charcode name: charcode
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0-nullsafety.3"
clock: clock:
dependency: transitive dependency: transitive
description: description:
name: clock name: clock
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0-nullsafety.3"
collection: collection:
dependency: transitive dependency: transitive
description: description:
name: collection name: collection
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0-nullsafety.3" version: "1.15.0-nullsafety.5"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
name: fake_async name: fake_async
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0-nullsafety.3"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
...@@ -64,23 +64,23 @@ packages: ...@@ -64,23 +64,23 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: matcher name: matcher
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.10-nullsafety.1" version: "0.12.10-nullsafety.3"
meta: meta:
dependency: transitive dependency: transitive
description: description:
name: meta name: meta
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0-nullsafety.6"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety.1" version: "1.8.0-nullsafety.3"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
...@@ -90,58 +90,58 @@ packages: ...@@ -90,58 +90,58 @@ packages:
dependency: transitive dependency: transitive
description: description:
name: source_span name: source_span
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0-nullsafety.2" version: "1.8.0-nullsafety.4"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
name: stack_trace name: stack_trace
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.10.0-nullsafety.1" version: "1.10.0-nullsafety.6"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
name: stream_channel name: stream_channel
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.1" version: "2.1.0-nullsafety.3"
string_scanner: string_scanner:
dependency: transitive dependency: transitive
description: description:
name: string_scanner name: string_scanner
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.0-nullsafety.1" version: "1.1.0-nullsafety.3"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
name: term_glyph name: term_glyph
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.0-nullsafety.1" version: "1.2.0-nullsafety.3"
test_api: test_api:
dependency: transitive dependency: transitive
description: description:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.19-nullsafety.2" version: "0.2.19-nullsafety.6"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.3.0-nullsafety.3" version: "1.3.0-nullsafety.5"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
name: vector_math name: vector_math
url: "https://pub.flutter-io.cn" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.0-nullsafety.3" version: "2.1.0-nullsafety.5"
sdks: sdks:
dart: ">=2.10.0-110 <2.11.0" dart: ">=2.12.0-0.0 <3.0.0"
flutter: ">=1.12.0 <2.0.0" flutter: ">=1.12.0 <2.0.0"
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论