Skip to content

Commit 05a3263

Browse files
authored
Add plugin and host registration to multiple_flutters example (flutter#942)
1 parent eb74d3f commit 05a3263

File tree

7 files changed

+104
-12
lines changed

7 files changed

+104
-12
lines changed

add_to_app/multiple_flutters/multiple_flutters_android/app/src/main/AndroidManifest.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="dev.flutter.multipleflutters">
44

5+
<!-- Provide required visibility configuration for API level 30 and above -->
6+
<queries>
7+
<intent>
8+
<action android:name="android.intent.action.VIEW" />
9+
<data android:scheme="https" />
10+
</intent>
11+
</queries>
12+
513
<application
614
android:name=".App"
715
android:allowBackup="true"

add_to_app/multiple_flutters/multiple_flutters_ios/MultipleFluttersIos/SingleFlutterViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// found in the LICENSE file.
44

55
import Flutter
6+
import FlutterPluginRegistrant
67
import Foundation
78

89
/// A FlutterViewController intended for the MyApp widget in the Flutter module.
@@ -16,6 +17,7 @@ class SingleFlutterViewController: FlutterViewController, DataModelObserver {
1617
init(withEntrypoint entryPoint: String?) {
1718
let appDelegate: AppDelegate = UIApplication.shared.delegate as! AppDelegate
1819
let newEngine = appDelegate.engines.makeEngine(withEntrypoint: entryPoint, libraryURI: nil)
20+
GeneratedPluginRegistrant.register(with: newEngine)
1921
super.init(engine: newEngine, nibName: nil, bundle: nil)
2022
DataModel.shared.addObserver(observer: self)
2123
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Uncomment the next line to define a global platform for your project
2-
# platform :ios, '9.0'
1+
# Copyright 2021 The Flutter team. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
34

45
flutter_application_path = '../multiple_flutters_module'
56
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')
67

78
target 'MultipleFluttersIos' do
8-
# Comment the next line if you don't want to use dynamic frameworks
99
use_frameworks!
1010
install_all_flutter_pods(flutter_application_path)
1111
end

add_to_app/multiple_flutters/multiple_flutters_ios/Podfile.lock

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,17 @@ PODS:
22
- Flutter (1.0.0)
33
- FlutterPluginRegistrant (0.0.1):
44
- Flutter
5+
- url_launcher
56
- multiple_flutters_module (0.0.1):
67
- Flutter
8+
- url_launcher (0.0.1):
9+
- Flutter
710

811
DEPENDENCIES:
912
- Flutter (from `../multiple_flutters_module/.ios/Flutter/engine`)
1013
- FlutterPluginRegistrant (from `../multiple_flutters_module/.ios/Flutter/FlutterPluginRegistrant`)
1114
- multiple_flutters_module (from `../multiple_flutters_module/.ios/Flutter`)
15+
- url_launcher (from `../multiple_flutters_module/.ios/.symlinks/plugins/url_launcher/ios`)
1216

1317
EXTERNAL SOURCES:
1418
Flutter:
@@ -17,12 +21,15 @@ EXTERNAL SOURCES:
1721
:path: "../multiple_flutters_module/.ios/Flutter/FlutterPluginRegistrant"
1822
multiple_flutters_module:
1923
:path: "../multiple_flutters_module/.ios/Flutter"
24+
url_launcher:
25+
:path: "../multiple_flutters_module/.ios/.symlinks/plugins/url_launcher/ios"
2026

2127
SPEC CHECKSUMS:
2228
Flutter: bdfa2e8fe0e2880a2c6a58a0b1a8675c262a07af
23-
FlutterPluginRegistrant: 2afd5ea46d3a949472c9b7da6462d8fbf7d8b16e
29+
FlutterPluginRegistrant: d0de10c7c4fc31cc6b676a5965b96100f7c035f7
2430
multiple_flutters_module: fdf461a0e4225614d475110d85db6fd6de5aeff1
31+
url_launcher: b6e016d912f04be9f5bf6e8e82dc599b7ba59649
2532

26-
PODFILE CHECKSUM: d7f39981f450db398859f05de2475ec53909a487
33+
PODFILE CHECKSUM: 91c00dfcff6ea3b8d853bf0c2411672a01ca993c
2734

28-
COCOAPODS: 1.10.1
35+
COCOAPODS: 1.11.2

add_to_app/multiple_flutters/multiple_flutters_module/lib/main.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import 'package:flutter/material.dart';
66
import 'package:flutter/services.dart';
7+
import 'package:url_launcher/url_launcher.dart' as launcher;
78

89
void main() => runApp(const MyApp(color: Colors.blue));
910

@@ -90,6 +91,17 @@ class _MyHomePageState extends State<MyHomePage> {
9091
},
9192
child: const Text('Next'),
9293
),
94+
ElevatedButton(
95+
onPressed: () async {
96+
// Use the url_launcher plugin to open the Flutter docs in
97+
// a browser.
98+
const url = 'https://flutter.dev/docs';
99+
if (await launcher.canLaunch(url)) {
100+
launcher.launch(url);
101+
}
102+
},
103+
child: const Text('Open Flutter Docs'),
104+
),
93105
],
94106
),
95107
),

add_to_app/multiple_flutters/multiple_flutters_module/pubspec.lock

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ packages:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.8.1"
10+
version: "2.8.2"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
@@ -21,7 +21,7 @@ packages:
2121
name: characters
2222
url: "https://pub.dartlang.org"
2323
source: hosted
24-
version: "1.1.0"
24+
version: "1.2.0"
2525
charcode:
2626
dependency: transitive
2727
description:
@@ -74,6 +74,18 @@ packages:
7474
description: flutter
7575
source: sdk
7676
version: "0.0.0"
77+
flutter_web_plugins:
78+
dependency: transitive
79+
description: flutter
80+
source: sdk
81+
version: "0.0.0"
82+
js:
83+
dependency: transitive
84+
description:
85+
name: js
86+
url: "https://pub.dartlang.org"
87+
source: hosted
88+
version: "0.6.3"
7789
lints:
7890
dependency: transitive
7991
description:
@@ -87,7 +99,7 @@ packages:
8799
name: matcher
88100
url: "https://pub.dartlang.org"
89101
source: hosted
90-
version: "0.12.10"
102+
version: "0.12.11"
91103
meta:
92104
dependency: transitive
93105
description:
@@ -102,6 +114,13 @@ packages:
102114
url: "https://pub.dartlang.org"
103115
source: hosted
104116
version: "1.8.0"
117+
plugin_platform_interface:
118+
dependency: transitive
119+
description:
120+
name: plugin_platform_interface
121+
url: "https://pub.dartlang.org"
122+
source: hosted
123+
version: "2.0.2"
105124
sky_engine:
106125
dependency: transitive
107126
description: flutter
@@ -148,20 +167,63 @@ packages:
148167
name: test_api
149168
url: "https://pub.dartlang.org"
150169
source: hosted
151-
version: "0.4.2"
170+
version: "0.4.3"
152171
typed_data:
153172
dependency: transitive
154173
description:
155174
name: typed_data
156175
url: "https://pub.dartlang.org"
157176
source: hosted
158177
version: "1.3.0"
178+
url_launcher:
179+
dependency: "direct main"
180+
description:
181+
name: url_launcher
182+
url: "https://pub.dartlang.org"
183+
source: hosted
184+
version: "6.0.12"
185+
url_launcher_linux:
186+
dependency: transitive
187+
description:
188+
name: url_launcher_linux
189+
url: "https://pub.dartlang.org"
190+
source: hosted
191+
version: "2.0.2"
192+
url_launcher_macos:
193+
dependency: transitive
194+
description:
195+
name: url_launcher_macos
196+
url: "https://pub.dartlang.org"
197+
source: hosted
198+
version: "2.0.2"
199+
url_launcher_platform_interface:
200+
dependency: transitive
201+
description:
202+
name: url_launcher_platform_interface
203+
url: "https://pub.dartlang.org"
204+
source: hosted
205+
version: "2.0.4"
206+
url_launcher_web:
207+
dependency: transitive
208+
description:
209+
name: url_launcher_web
210+
url: "https://pub.dartlang.org"
211+
source: hosted
212+
version: "2.0.4"
213+
url_launcher_windows:
214+
dependency: transitive
215+
description:
216+
name: url_launcher_windows
217+
url: "https://pub.dartlang.org"
218+
source: hosted
219+
version: "2.0.2"
159220
vector_math:
160221
dependency: transitive
161222
description:
162223
name: vector_math
163224
url: "https://pub.dartlang.org"
164225
source: hosted
165-
version: "2.1.0"
226+
version: "2.1.1"
166227
sdks:
167-
dart: ">=2.12.0 <3.0.0"
228+
dart: ">=2.14.0 <3.0.0"
229+
flutter: ">=2.5.0"

add_to_app/multiple_flutters/multiple_flutters_module/pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ environment:
99
dependencies:
1010
flutter:
1111
sdk: flutter
12+
url_launcher: ^6.0.6
1213

1314
cupertino_icons: ^1.0.0
1415

0 commit comments

Comments
 (0)