Commit 790ce248 by Administrator

添加平台代码的编译判断入口

1 parent 22b6cd9c
......@@ -8,3 +8,5 @@ flutter pub get
flutter run -d macos
flutter run -d 00008030-001C75810E42402E --release
......@@ -33,6 +33,7 @@ import 'package:appframe/services/dispatcher.dart';
import 'package:fluwx/fluwx.dart';
import 'package:get_it/get_it.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'dart:io' show Platform;
final getIt = GetIt.instance;
......@@ -41,7 +42,9 @@ Future<void> setupLocator() async {
getIt.registerSingleton<Fluwx>(
await (() async {
Fluwx fluwx = Fluwx();
if (Platform.isAndroid || Platform.isIOS) {
await fluwx.registerApi(appId: "wx8c32ea248f0c7765", universalLink: "https://univerallink.banxe.cn/link/");
}
return fluwx;
})(),
);
......
import 'package:fluwx/fluwx.dart';
import 'dart:io' show Platform;
final Fluwx fluwx = Fluwx();
Future<void> registerWechatApi() async {
if (Platform.isAndroid || Platform.isIOS) {
await fluwx.registerApi(appId: "wx8c32ea248f0c7765", universalLink: "https://dev.banxiaoer.net/path/to/wechat/");
} else {
print("✅ Fluwx is not supported on this platform (${Platform.operatingSystem}). Skip registerApi().");
}
}
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!