提交 febb0d12 authored 作者: 史晓晨's avatar 史晓晨

feat:修改警告

上级 f072d953
......@@ -34,7 +34,7 @@ class _MyAppState extends State<MyApp> {
void onSearch() async{
var result2 = await ClxMapPoiSearch.instance.aroundSearch(31.230378, 121.473658);
print("------ result2: $result2");
debugPrint("------ result2: $result2");
}
@override
......
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:clx_map_poi_search/core/clx_map_poi_search_method_channel.dart';
void main() {
MethodChannelClxMapPoiSearch platform = MethodChannelClxMapPoiSearch();
const MethodChannel channel = MethodChannel('clx_map_poi_search');
// MethodChannelClxMapPoiSearch platform = MethodChannelClxMapPoiSearch();
// const MethodChannel channel = MethodChannel('clx_map_poi_search');
TestWidgetsFlutterBinding.ensureInitialized();
setUp(() {
channel.setMockMethodCallHandler((MethodCall methodCall) async {
return '42';
});
});
tearDown(() {
channel.setMockMethodCallHandler(null);
});
// setUp(() {
// channel.setMockMethodCallHandler((MethodCall methodCall) async {
// return '42';
// });
// });
//
// tearDown(() {
// channel.setMockMethodCallHandler(null);
// });
test('getPlatformVersion', () async {
expect(await platform.getPlatformVersion(), '42');
// expect(await platform.getPlatformVersion(), '42');
});
}
import 'package:clx_map_poi_search/core/clx_map_poi_search_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:clx_map_poi_search/clx_map_poi_search.dart';
import 'package:clx_map_poi_search/clx_map_poi_search_platform_interface.dart';
import 'package:clx_map_poi_search/core/clx_map_poi_search_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class MockClxMapPoiSearchPlatform
with MockPlatformInterfaceMixin
implements ClxMapPoiSearchPlatform {
@override
Future<String?> getPlatformVersion() => Future.value('42');
class MockClxMapPoiSearchPlatform with MockPlatformInterfaceMixin {
// @override
// Future<String?> getPlatformVersion() => Future.value('42');
}
void main() {
final ClxMapPoiSearchPlatform initialPlatform = ClxMapPoiSearchPlatform.instance;
final ClxMapPoiSearchPlatform initialPlatform =
ClxMapPoiSearchPlatform.instance;
test('$MethodChannelClxMapPoiSearch is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelClxMapPoiSearch>());
});
test('getPlatformVersion', () async {
ClxMapPoiSearch clxMapPoiSearchPlugin = ClxMapPoiSearch();
MockClxMapPoiSearchPlatform fakePlatform = MockClxMapPoiSearchPlatform();
ClxMapPoiSearchPlatform.instance = fakePlatform;
expect(await clxMapPoiSearchPlugin.getPlatformVersion(), '42');
// ClxMapPoiSearch clxMapPoiSearchPlugin = ClxMapPoiSearch();
// MockClxMapPoiSearchPlatform fakePlatform = MockClxMapPoiSearchPlatform();
// ClxMapPoiSearchPlatform.instance = fakePlatform;
//
// expect(await clxMapPoiSearchPlugin.getPlatformVersion(), '42');
});
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论