11// Copyright 2019, the Chromium project authors. Please see the AUTHORS file
22// for details. All rights reserved. Use of this source code is governed by a
33// BSD-style license that can be found in the LICENSE file.
4+
45import 'dart:io' ;
56
67import 'package:flutter/services.dart' ;
@@ -12,13 +13,20 @@ void main() {
1213 IntegrationTestWidgetsFlutterBinding .ensureInitialized ();
1314
1415 testWidgets ('Can launch share' , (WidgetTester tester) async {
16+ final params = ShareParams (
17+ text: 'message' ,
18+ subject: 'title' ,
19+ );
1520 // Check isNotNull because we cannot wait for ShareResult
16- expect (Share . share ('message' , subject : 'title' ), isNotNull);
21+ expect (SharePlus .instance. share (params ), isNotNull);
1722 });
1823
1924 testWidgets ('Can launch shareUri' , (WidgetTester tester) async {
25+ final params = ShareParams (
26+ uri: Uri .parse ('https://example.com' ),
27+ );
2028 // Check isNotNull because we cannot wait for ShareResult
21- expect (Share . shareUri ( Uri . parse ( 'https://example.com' ) ), isNotNull);
29+ expect (SharePlus .instance. share (params ), isNotNull);
2230 }, skip: ! Platform .isAndroid && ! Platform .isIOS);
2331
2432 testWidgets ('Can shareXFile created using File.fromData()' ,
@@ -27,6 +35,10 @@ void main() {
2735 final XFile file =
2836 XFile .fromData (bytes, name: 'image.jpg' , mimeType: 'image/jpeg' );
2937
30- expect (Share .shareXFiles ([file], text: "example" ), isNotNull);
38+ final params = ShareParams (
39+ files: [file],
40+ text: 'message' ,
41+ );
42+ expect (SharePlus .instance.share (params), isNotNull);
3143 });
3244}
0 commit comments