1
0
mirror of https://github.com/flutter/samples.git synced 2025-11-10 06:48:26 +00:00

[federated_plugin] adds platform interface implementation and plugin implementation for Android (#503)

This commit is contained in:
Ayush Bherwani
2020-07-29 09:17:36 +05:30
committed by GitHub
parent 3bc860f5df
commit 6d909874db
19 changed files with 622 additions and 101 deletions

View File

@@ -0,0 +1,28 @@
// Copyright 2020 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:federated_plugin_platform_interface/location_method_channel.dart';
import 'package:federated_plugin_platform_interface/location_model.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
group('MethodChannel test', () {
final location = Location(latitude: 1.0, longitude: 2.0);
MethodChannel('location').setMockMethodCallHandler((call) async {
if (call.method == 'getLocation') {
return [location.longitude, location.latitude];
}
});
test('getLocation method test', () async {
final locationMethodChannel = LocationMethodChannel();
final result = await locationMethodChannel.getLocation();
expect(result.longitude, location.longitude);
expect(result.latitude, result.latitude);
});
});
}