├── .gitignore
├── .metadata
├── CHANGELOG.md
├── LICENSE
├── README.md
├── android
├── .gitignore
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── settings.gradle
└── src
│ └── main
│ ├── AndroidManifest.xml
│ └── kotlin
│ └── com
│ └── pycampers
│ └── plugin_scaffold
│ ├── MainThreadClasses.kt
│ └── PluginScaffoldPlugin.kt
├── example
├── .gitignore
├── .metadata
├── README.md
├── android
│ ├── .gitignore
│ ├── app
│ │ ├── build.gradle
│ │ └── src
│ │ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ │ ├── main
│ │ │ ├── AndroidManifest.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── pycampers
│ │ │ │ │ └── plugin_scaffold_example
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── res
│ │ │ │ ├── drawable
│ │ │ │ └── launch_background.xml
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ └── ic_launcher.png
│ │ │ │ └── values
│ │ │ │ └── styles.xml
│ │ │ └── profile
│ │ │ └── AndroidManifest.xml
│ ├── build.gradle
│ ├── gradle.properties
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ └── settings.gradle
├── ios
│ ├── .gitignore
│ ├── Flutter
│ │ ├── AppFrameworkInfo.plist
│ │ ├── Debug.xcconfig
│ │ └── Release.xcconfig
│ ├── Podfile
│ ├── Podfile.lock
│ ├── Runner.xcodeproj
│ │ ├── project.pbxproj
│ │ ├── project.xcworkspace
│ │ │ └── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── Runner
│ │ ├── AppDelegate.swift
│ │ ├── Assets.xcassets
│ │ ├── AppIcon.appiconset
│ │ │ ├── Contents.json
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ └── LaunchImage.imageset
│ │ │ ├── Contents.json
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ └── README.md
│ │ ├── Base.lproj
│ │ ├── LaunchScreen.storyboard
│ │ └── Main.storyboard
│ │ ├── Info.plist
│ │ └── Runner-Bridging-Header.h
├── lib
│ └── main.dart
├── pubspec.lock
└── pubspec.yaml
├── ios
├── .gitignore
├── Assets
│ └── .gitkeep
├── Classes
│ ├── PluginScaffoldHelper.h
│ ├── PluginScaffoldHelper.m
│ ├── PluginScaffoldPlugin.h
│ ├── PluginScaffoldPlugin.m
│ └── SwiftPluginScaffoldPlugin.swift
└── plugin_scaffold.podspec
├── lib
└── plugin_scaffold.dart
├── pubspec.lock
└── pubspec.yaml
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .DS_Store
3 | .dart_tool/
4 |
5 | .packages
6 | .pub/
7 |
8 | build/
9 | *.iml
--------------------------------------------------------------------------------
/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
8 | channel: stable
9 |
10 | project_type: plugin
11 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 0.0.1
2 |
3 | * TODO: Describe initial release.
4 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://www.jaaga.in/labs)
2 | [](https://pub.dartlang.org/packages/plugin_scaffold)
3 |
4 | # Flutter Plugin Scaffold
5 |
6 | Tired of endless switch-cases in your Flutter plugin code?
7 | This module is for you!
8 |
9 | - Dynamic method dispatch (Only Kotlin)
10 | - Built-in error serialization for both platforms
11 | - Superior streams.
12 |
13 | Used to create plugins such as [flutter_cogntio_plugin](https://github.com/pycampers/flutter_cognito_plugin),
14 | [rx_ble](https://github.com/pycampers/flutter-rx-ble), [flutter_pdf_viewer](https://github.com/pycampers/flutter_pdf_viewer),
15 | etc.
16 |
17 | ## TLDR
18 |
19 | It lets you turn this:-
20 |
21 | ```kotlin
22 | channel.setMethodCallHandler { call, result ->
23 | when (call.method) {
24 | "orange" -> ...
25 | "banana" -> ...
26 | "mango" -> ...
27 | "apple" -> ...
28 | }
29 | }
30 | ```
31 |
32 | Into this beauty:-
33 |
34 | ```kotlin
35 | import com.pycampers.plugin_scaffold.createPluginScaffold
36 |
37 |
38 | class MyPlugin {
39 | fun orange(call: MethodCall, result: Result) {
40 | ...
41 | }
42 |
43 | fun banana(call: MethodCall, result: Result) {
44 | ...
45 | }
46 |
47 | fun mango(call: MethodCall, result: Result) {
48 | ...
49 | }
50 |
51 | fun apple(call: MethodCall, result: Result) {
52 | ...
53 | }
54 | }
55 |
56 | createPluginScaffold(registrar.messenger(), "myFancyChannel", MyPlugin())
57 | ```
58 |
59 | ## Errors
60 |
61 | Any errors that occur in native code tend to instantly crash the app.
62 | Sending them back to flutter can be a real PITA.
63 |
64 | This module does everything in its power to prevent such mishaps.
65 |
66 | So yes,
67 | You get 100% dart catch-able `PlatformExceptions` with stacktraces of native code!
68 |
69 | ```
70 | D/MethodCallDispatcher( 3572): piping exception to flutter: java.lang.IllegalArgumentException: Hello from Kotlin!
71 | E/flutter ( 3572): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: PlatformException(java.lang.IllegalArgumentException, Hello from Kotlin!, java.lang.IllegalArgumentException: Hello from Kotlin!
72 | E/flutter ( 3572): at com.pycampers.method_call_dispatcher_example.MyPlugin$myBrokenCallbackMethod$1$run$1.invoke(MainActivity.kt:33)
73 | E/flutter ( 3572): at com.pycampers.method_call_dispatcher_example.MyPlugin$myBrokenCallbackMethod$1$run$1.invoke(MainActivity.kt:30)
74 | E/flutter ( 3572): at com.pycampers.method_call_dispatcher.MethodCallDispatcherPluginKt.trySend(MethodCallDispatcherPlugin.kt:52)
75 | E/flutter ( 3572): at com.pycampers.method_call_dispatcher_example.MyPlugin$myBrokenCallbackMethod$1.run(MainActivity.kt:32)
76 | E/flutter ( 3572): at java.util.Timer$TimerImpl.run(Timer.java:284)
77 | E/flutter ( 3572): )
78 | ```
79 |
80 | ```
81 | [VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: PlatformException(Runner.MyError.fatalError, The operation couldn’t be completed. (Runner.MyError error 0.), 0 plugin_scaffold 0x0000000106131435 $s15plugin_scaffold14serializeErrorySo07FlutterD0CypF + 309
82 | 1 plugin_scaffold 0x0000000106135a39 $s15plugin_scaffold20createPluginScaffold9messenger11channelName9methodMap05eventJ0So20FlutterMethodChannelC_SDySSSo0l5EventN0CGtSo0L15BinaryMessenger_p_SSSDySSypGSDySSSo0L13StreamHandler_So8NSObjectpGtFySo0lM4CallC_yypSgctcfU_yycfU_ASycfU_ + 121
83 | 2 plugin_scaffold 0x000000010613654d $s15plugin_scaffold20createPluginScaffold9messenger11channelName9methodMap05eventJ0So20FlutterMethodChannelC_SDySSSo0l5EventN0CGtSo0L15BinaryMessenger_p_SSSDySSypGSDySSSo0L13StreamHandler_So8NSObjectpGtFySo0lM4CallC_yypSgctcfU_yycfU_ASycfU_TA + 13
84 | 3 plugin_scaffold 0x0000000106133099 $s15plugin_scaffold7trySendyyyypSgc_ACyKcSgtFyycfU_ + 297
85 | <…>
86 | [VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: PlatformException(Error Domain=hello Code=123 "(null)", The operation couldn’t be completed. (hello error 123.), 0 plugin_scaffold 0x0000000106131435 $s15plugin_scaffold14serializeErrorySo07FlutterD0CypF + 309
87 | 1 plugin_scaffold 0x0000000106135a39 $s15plugin_scaffold20createPluginScaffold9messenger11channelName9methodMap05eventJ0So20FlutterMethodChannelC_SDySSSo0l5EventN0CGtSo0L15BinaryMessenger_p_SSSDySSypGSDySSSo0L13StreamHandler_So8NSObjectpGtFySo0lM4CallC_yypSgctcfU_yycfU_ASycfU_ + 121
88 | 2 plugin_scaffold 0x000000010613654d $s15plugin_scaffold20createPluginScaffold9messenger11channelName9methodMap05eventJ0So20FlutterMethodChannelC_SDySSSo0l5EventN0CGtSo0L15BinaryMessenger_p_SSSDySSypGSDySSSo0L13StreamHandler_So8NSObjectpGtFySo0lM4CallC_yypSgctcfU_yycfU_ASycfU_TA + 13
89 | 3 plugin_scaffold 0x0000000106133099 $s15plugin_scaffold7trySendyyyypSgc_ACyKcSgtFyycfU_ + <…>
90 | ```
91 |
92 | ## Streams
93 |
94 | Flutter's `EventChannel`, has a flaw in that it only lets you open only a single stream at a time.
95 |
96 | Plugin Scaffold's stream methods build upon regular `MethodChannel` callback methods,
97 | and provide a more flexible solution.
98 |
99 | *This comes with a caveat, though. You can no longer use regular `MethodChannel.setMethodCallHandler()`,
100 | and must use `PluginScaffold.setMethodCallHandler()` instead.*
101 |
102 | ## Install
103 |
104 | First install the plugin using regular instructions on [dart pub](https://pub.dartlang.org/packages/plugin_scaffold#-installing-tab-).
105 |
106 | Next, add the follwoing to `ios/.podspec`
107 |
108 | ```
109 | Pod::Spec.new do |s|
110 | ...
111 |
112 | s.dependency 'plugin_scaffold'
113 | end
114 | ```
115 |
116 | ## Usage
117 |
118 | The example is app available @ [`main.dart`](example/lib/main.dart),
119 | [`MainActivity.kt`](example/android/app/src/main/kotlin/com/pycampers/plugin_scaffold_example/MainActivity.kt)
120 | & [`AppDelegate.dart`](example/ios/Runner/AppDelegate.swift)
121 |
122 | The core plugin code can be found @ [`plugin_scaffold.dart`](lib/plugin_scaffold.dart),
123 | [`MethodCallDispatcherPlugin.kt`](android/src/main/kotlin/com/pycampers/plugin_scaffold/PluginScaffoldPlugin.kt)
124 | & [`SwiftPluginScaffoldPlugin.swift`](ios/Classes/SwiftPluginScaffoldPlugin.swift)
125 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | group 'com.pycampers.plugin_scaffold'
2 | version '1.0-SNAPSHOT'
3 |
4 | buildscript {
5 | ext.kotlin_version = '1.3.50'
6 | repositories {
7 | google()
8 | jcenter()
9 | }
10 |
11 | dependencies {
12 | classpath 'com.android.tools.build:gradle:3.5.0'
13 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14 | }
15 | }
16 |
17 | rootProject.allprojects {
18 | repositories {
19 | google()
20 | jcenter()
21 | }
22 | }
23 |
24 | apply plugin: 'com.android.library'
25 | apply plugin: 'kotlin-android'
26 |
27 | android {
28 | compileSdkVersion 28
29 |
30 | sourceSets {
31 | main.java.srcDirs += 'src/main/kotlin'
32 | }
33 | defaultConfig {
34 | minSdkVersion 16
35 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
36 | }
37 | lintOptions {
38 | disable 'InvalidPackage'
39 | }
40 | }
41 |
42 | dependencies {
43 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
44 | }
45 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
6 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'plugin_scaffold'
2 |
--------------------------------------------------------------------------------
/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/android/src/main/kotlin/com/pycampers/plugin_scaffold/MainThreadClasses.kt:
--------------------------------------------------------------------------------
1 | package com.pycampers.plugin_scaffold
2 |
3 | import android.os.Handler
4 | import android.os.Looper
5 | import android.util.Log
6 | import io.flutter.plugin.common.EventChannel
7 | import io.flutter.plugin.common.MethodChannel
8 |
9 | val handler = Handler(Looper.getMainLooper())
10 |
11 | class MainThreadEventSink(val channel: MethodChannel, val prefix: String) :
12 | EventChannel.EventSink {
13 | override fun success(event: Any?) {
14 | handler.post {
15 | channel.invokeMethod("$prefix/$ON_SUCCESS", event)
16 | }
17 | }
18 |
19 | override fun error(errorCode: String?, errorMessage: String?, errorDetails: Any?) {
20 | handler.post {
21 | channel.invokeMethod(
22 | "$prefix/$ON_ERROR",
23 | listOf(errorCode, errorMessage, errorDetails)
24 | )
25 | }
26 | }
27 |
28 | override fun endOfStream() {
29 | handler.post {
30 | channel.invokeMethod("$prefix/$END_OF_STREAM", null)
31 | }
32 | }
33 | }
34 |
35 | class MainThreadResult(val parent: MethodChannel.Result) : MethodChannel.Result {
36 | override fun notImplemented() {
37 | wrapMainThreadResult {
38 | parent.notImplemented();
39 | }
40 | }
41 |
42 | override fun error(errorCode: String, errorMessage: String?, errorDetails: Any?) {
43 | wrapMainThreadResult {
44 | parent.error(errorCode, errorMessage, errorDetails)
45 | }
46 | }
47 |
48 | override fun success(result: Any?) {
49 | wrapMainThreadResult {
50 | parent.success(result)
51 | }
52 | }
53 | }
54 |
55 | fun wrapMainThreadResult(fn: UnitFn) {
56 | handler.post {
57 | ignoreIllegalState(fn)
58 | }
59 | }
60 |
61 | /**
62 | * Runs [fn], ignoring [IllegalStateException], if encountered.
63 | *
64 | * Workaround for https://github.com/flutter/flutter/issues/29092.
65 | */
66 | fun ignoreIllegalState(fn: UnitFn) {
67 | try {
68 | fn()
69 | } catch (e: IllegalStateException) {
70 | Log.d(
71 | TAG,
72 | "Ignoring exception: <$e>. See https://github.com/flutter/flutter/issues/29092 for details."
73 | )
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/android/src/main/kotlin/com/pycampers/plugin_scaffold/PluginScaffoldPlugin.kt:
--------------------------------------------------------------------------------
1 | package com.pycampers.plugin_scaffold
2 |
3 | import androidx.annotation.NonNull;
4 | import io.flutter.embedding.engine.plugins.FlutterPlugin
5 | import io.flutter.plugin.common.MethodCall
6 | import io.flutter.plugin.common.MethodChannel
7 | import io.flutter.plugin.common.MethodChannel.MethodCallHandler
8 | import io.flutter.plugin.common.MethodChannel.Result
9 | import io.flutter.plugin.common.PluginRegistry.Registrar
10 |
11 | import android.os.AsyncTask
12 | import android.os.Handler
13 | import android.util.Log
14 | import io.flutter.app.FlutterActivity
15 | import io.flutter.plugin.common.BinaryMessenger
16 | import io.flutter.plugin.common.EventChannel.EventSink
17 | import java.io.PrintWriter
18 | import java.io.StringWriter
19 | import java.lang.reflect.Method
20 | const val TAG = "PluginScaffold"
21 |
22 | const val ON_LISTEN = "OnListen"
23 | const val ON_CANCEL = "OnCancel"
24 | const val ON_SUCCESS = "onSuccess"
25 | const val ON_ERROR = "onError"
26 | const val END_OF_STREAM = "endOfStream"
27 |
28 | private val methodSignature = listOf(MethodCall::class.java, Result::class.java)
29 | private val onListenSignature =
30 | listOf(Int::class.java, Object::class.java, EventSink::class.java)
31 |
32 | typealias OnError = (errorCode: String, errorMessage: String?, errorDetails: Any?) -> Unit
33 | typealias OnSuccess = (result: Any?) -> Unit
34 | typealias AnyFn = () -> Any?
35 | typealias UnitFn = () -> Unit
36 | typealias MethodMap = MutableMap
37 |
38 | /**
39 | * Create a plugin with the provided [channelName].
40 | *
41 | * The methods of [pluginObj] having parameters - ([MethodCall], [Result]),
42 | * are automatically exposed through the returned [MethodChannel]:
43 | *
44 | * The [messenger] can be passed in various ways.
45 | * - If you're inside a subclass of [FlutterActivity], pass [FlutterActivity.getFlutterView] (generally regular flutter apps)
46 | * - If you have access to a [Registrar] object, pass [Registrar.messenger] (generally flutter plugin projects)
47 | *
48 | * If [runOnMainThread] is set to `true`,
49 | * the methods in [pluginObj] will be invoked from the main thread (using [Handler.post]).
50 | * Otherwise, they will be invoked from an [AsyncTask].
51 | */
52 | fun createPluginScaffold(
53 | messenger: BinaryMessenger,
54 | channelName: String,
55 | pluginObj: Any = Any(),
56 | runOnMainThread: Boolean = false
57 | ): MethodChannel {
58 | val methods = buildMethodMap(pluginObj)
59 | val (onListenMethods, onCancelMethods) = buildStreamMethodMap(pluginObj)
60 | val channel = MethodChannel(messenger, channelName)
61 | val wrapper = createMethodWrapper(runOnMainThread)
62 |
63 | channel.setMethodCallHandler { call, result ->
64 | val name = call.method
65 | val args = call.arguments
66 | val mainResult = MainThreadResult(result)
67 |
68 | //
69 | // Try to find the method in [methods], [onListenMethods] and [onCancelMethods],
70 | // and invoke it using [wrapFunCall].
71 | //
72 | // If not found, invoke [Result.notImplemented]
73 | //
74 |
75 | methods[name]?.let {
76 | Log.d(TAG, "invoke { channel: $channelName, method: $name(), args: $args }")
77 | wrapper(mainResult) {
78 | it.invoke(pluginObj, call, mainResult)
79 | }
80 |
81 | return@setMethodCallHandler
82 | }
83 |
84 | onListenMethods[name]?.let {
85 | val streamName = getStreamName(name)!!
86 | val (hashCode: Any?, streamArgs: Any?) = args as List<*>
87 | val prefix = "$streamName/$hashCode"
88 | val sink = MainThreadEventSink(channel, prefix)
89 |
90 | Log.d(
91 | TAG,
92 | "activate stream { channel: $channelName, stream: $streamName, hashCode: $hashCode, args: $streamArgs }"
93 | )
94 | wrapper(mainResult) {
95 | it.invoke(pluginObj, hashCode, streamArgs, sink)
96 | }
97 |
98 | return@setMethodCallHandler
99 | }
100 |
101 | onCancelMethods[name]?.let {
102 | val streamName = getStreamName(name)!!
103 | val (hashCode: Any?, streamArgs: Any?) = args as List<*>
104 |
105 | Log.d(
106 | TAG,
107 | "de-activate stream { channel: $channelName, stream: $streamName, hashCode: $hashCode, args: $streamArgs }"
108 | )
109 | wrapper(mainResult) {
110 | it.invoke(pluginObj, hashCode, streamArgs)
111 | }
112 |
113 | return@setMethodCallHandler
114 | }
115 |
116 | mainResult.notImplemented()
117 | }
118 |
119 | return channel
120 | }
121 |
122 | fun createMethodWrapper(runOnMainThread: Boolean): (Result, UnitFn) -> Unit {
123 | if (runOnMainThread) {
124 | return { result, fn ->
125 | handler.post {
126 | catchErrors(result, fn)
127 | }
128 | }
129 | } else {
130 | return { result, fn ->
131 | DoAsync {
132 | catchErrors(result, fn)
133 | }
134 | }
135 | }
136 | }
137 |
138 | /**
139 | * Try to send the value returned by [fn] using [onSuccess].
140 | *
141 | * It is advisable to wrap any native code inside [fn],
142 | * because this will automatically catch and send to dart exceptions using
143 | * using [sendThrowable] and [onError] if required.
144 | */
145 | fun trySend(onSuccess: OnSuccess, onError: OnError, fn: AnyFn? = null) {
146 | val value: Any?
147 | try {
148 | value = fn?.invoke()
149 | onSuccess(if (value is Unit) null else value)
150 | } catch (e: Throwable) {
151 | sendThrowable(onError, e)
152 | }
153 | }
154 |
155 | fun trySend(result: Result, fn: AnyFn? = null) {
156 | trySend(result::success, result::error, fn)
157 | }
158 |
159 | fun trySend(events: EventSink, fn: AnyFn? = null) {
160 | trySend(events::success, events::error, fn)
161 | }
162 |
163 | /**
164 | * Run [fn].
165 | * Automatically send exceptions using error using [sendThrowable] if required.
166 | *
167 | * This differs from [trySend],
168 | * in that it won't invoke [Result.success] using the return value of [fn].
169 | */
170 | fun catchErrors(onError: OnError, fn: UnitFn) {
171 | try {
172 | fn()
173 | } catch (e: Throwable) {
174 | sendThrowable(onError, e)
175 | }
176 | }
177 |
178 | fun catchErrors(result: Result, fn: UnitFn) {
179 | catchErrors(result::error, fn)
180 | }
181 |
182 | fun catchErrors(events: EventSink, fn: UnitFn) {
183 | catchErrors(events::error, fn)
184 | }
185 |
186 | /**
187 | * Serialize the [throwable] and send it using [onError].
188 | */
189 | fun sendThrowable(onError: OnError, throwable: Throwable) {
190 | val e = throwable.cause ?: throwable
191 | onError(
192 | e.javaClass.canonicalName ?: "null",
193 | e.message,
194 | serializeStackTrace(e)
195 | )
196 | }
197 |
198 | fun sendThrowable(result: Result, throwable: Throwable) {
199 | sendThrowable(result::error, throwable)
200 | }
201 |
202 | fun sendThrowable(events: EventSink, throwable: Throwable) {
203 | sendThrowable(events::error, throwable)
204 | }
205 |
206 | /**
207 | * Serialize the stacktrace contained in [throwable] to a [String].
208 | */
209 | fun serializeStackTrace(throwable: Throwable): String {
210 | val sw = StringWriter()
211 | val pw = PrintWriter(sw)
212 | throwable.printStackTrace(pw)
213 | return sw.toString()
214 | }
215 |
216 | fun buildMethodMap(pluginObj: Any): MethodMap {
217 | val map: MethodMap = mutableMapOf()
218 |
219 | for (method in pluginObj::class.java.methods) {
220 | val paramList = method.parameterTypes.toList()
221 | if (paramList != methodSignature) continue
222 |
223 | map[method.name] = method
224 | }
225 |
226 | return map
227 | }
228 |
229 | fun buildStreamMethodMap(pluginObj: Any): Pair {
230 | val onListenMethods: MethodMap = mutableMapOf()
231 | val onCancelMethods: MethodMap = mutableMapOf()
232 | val cls = pluginObj::class.java
233 |
234 | for (listenMethod in cls.methods) {
235 | val paramList = listenMethod.parameterTypes.toList()
236 | if (paramList != onListenSignature) continue
237 |
238 | val onListenName = listenMethod.name
239 | val streamName = getStreamName(onListenName) ?: continue
240 | val onCancelName = streamName + ON_CANCEL
241 |
242 | val cancelMethod: Method
243 | try {
244 | cancelMethod = cls.getMethod(onCancelName, Int::class.java, Object::class.java)
245 | } catch (e: NoSuchMethodException) {
246 | Log.w(
247 | TAG,
248 | "Found \"$onListenName()\" in \"$cls\", but accompanying method \"$onCancelName()\" was not found!"
249 | )
250 | continue
251 | }
252 |
253 | onListenMethods[onListenName] = listenMethod
254 | onCancelMethods[onCancelName] = cancelMethod
255 | }
256 |
257 | return Pair(onListenMethods, onCancelMethods)
258 | }
259 |
260 | fun getStreamName(methodName: String): String? {
261 | val name =
262 | when {
263 | methodName.endsWith(ON_LISTEN) -> methodName.substring(
264 | 0,
265 | methodName.length - ON_LISTEN.length
266 | )
267 | methodName.endsWith(ON_CANCEL) -> methodName.substring(
268 | 0,
269 | methodName.length - ON_CANCEL.length
270 | )
271 | else -> null
272 | }
273 |
274 | if (name != null && name.isNotEmpty()) {
275 | return name
276 | }
277 |
278 | return null
279 | }
280 |
281 | class DoAsync(val fn: () -> Unit) : AsyncTask() {
282 | init {
283 | execute()
284 | }
285 |
286 | override fun doInBackground(vararg params: Void?): Void? {
287 | fn()
288 | return null
289 | }
290 | }
291 |
292 |
293 | /** PluginScaffoldPlugin */
294 | public class PluginScaffoldPlugin: FlutterPlugin, MethodCallHandler {
295 | override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
296 | val channel = MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "plugin_scaffold")
297 | channel.setMethodCallHandler(PluginScaffoldPlugin());
298 | }
299 |
300 | // This static function is optional and equivalent to onAttachedToEngine. It supports the old
301 | // pre-Flutter-1.12 Android projects. You are encouraged to continue supporting
302 | // plugin registration via this function while apps migrate to use the new Android APIs
303 | // post-flutter-1.12 via https://flutter.dev/go/android-project-migration.
304 | //
305 | // It is encouraged to share logic between onAttachedToEngine and registerWith to keep
306 | // them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called
307 | // depending on the user's project. onAttachedToEngine or registerWith must both be defined
308 | // in the same class.
309 | companion object {
310 | @JvmStatic
311 | fun registerWith(registrar: Registrar) {
312 | val channel = MethodChannel(registrar.messenger(), "plugin_scaffold")
313 | channel.setMethodCallHandler(PluginScaffoldPlugin())
314 | }
315 | }
316 |
317 | override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
318 | if (call.method == "getPlatformVersion") {
319 | result.success("Android ${android.os.Build.VERSION.RELEASE}")
320 | } else {
321 | result.notImplemented()
322 | }
323 | }
324 |
325 | override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
326 | }
327 | }
328 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | .dart_tool/
26 | .flutter-plugins
27 | .flutter-plugins-dependencies
28 | .packages
29 | .pub-cache/
30 | .pub/
31 | /build/
32 |
33 | # Web related
34 | lib/generated_plugin_registrant.dart
35 |
36 | # Exceptions to above rules.
37 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
38 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 0b8abb4724aa590dd0f429683339b1e045a1594d
8 | channel: stable
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # plugin_scaffold_example
2 |
3 | Demonstrates how to use the plugin_scaffold plugin.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion 28
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | lintOptions {
36 | disable 'InvalidPackage'
37 | }
38 |
39 | defaultConfig {
40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41 | applicationId "com.pycampers.plugin_scaffold_example"
42 | minSdkVersion 16
43 | targetSdkVersion 28
44 | versionCode flutterVersionCode.toInteger()
45 | versionName flutterVersionName
46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
47 | }
48 |
49 | buildTypes {
50 | release {
51 | // TODO: Add your own signing config for the release build.
52 | // Signing with the debug keys for now, so `flutter run --release` works.
53 | signingConfig signingConfigs.debug
54 | }
55 | }
56 | }
57 |
58 | flutter {
59 | source '../..'
60 | }
61 |
62 | dependencies {
63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64 | testImplementation 'junit:junit:4.12'
65 | androidTestImplementation 'androidx.test:runner:1.1.1'
66 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
67 | }
68 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
8 |
12 |
19 |
20 |
21 |
22 |
23 |
24 |
26 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/pycampers/plugin_scaffold_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.pycampers.plugin_scaffold_example
2 |
3 | import androidx.annotation.NonNull
4 | import com.pycampers.plugin_scaffold.MainThreadEventSink
5 | import com.pycampers.plugin_scaffold.createPluginScaffold
6 | import com.pycampers.plugin_scaffold.trySend
7 | import io.flutter.embedding.android.FlutterActivity
8 | import io.flutter.embedding.engine.FlutterEngine
9 | import io.flutter.plugin.common.EventChannel
10 | import io.flutter.plugin.common.EventChannel.EventSink
11 | import io.flutter.plugin.common.MethodCall
12 | import io.flutter.plugin.common.MethodChannel.Result
13 | import io.flutter.plugins.GeneratedPluginRegistrant
14 | import java.util.Timer
15 | import kotlin.concurrent.timer
16 |
17 | class MyPlugin {
18 | fun myFancyMethod(call: MethodCall, result: Result) {
19 | /*
20 | Calling [result.success] / [result.error] multiple times is OK.
21 | In-built protection against https://github.com/flutter/flutter/issues/29092.
22 | */
23 | result.success("Hello from Kotlin!")
24 | result.success("Hello from Kotlin!")
25 | }
26 |
27 | fun myBrokenMethod(call: MethodCall, result: Result) {
28 | /*
29 | This won't crash the app!
30 | The exception will be serialized to flutter, and is catch-able in flutter.
31 | */
32 | throw IllegalArgumentException("Error from Kotlin 1!")
33 | }
34 |
35 | fun myBrokenCallbackMethod(call: MethodCall, result: Result) {
36 | /*
37 | Automatic exception handling can only work in non-callback, synchronous contexts.
38 |
39 | So, trySend guarantees that app won't crash,
40 | and errors will be serialized to flutter,
41 | even in a callback context.
42 | */
43 | java.util.Timer().schedule(
44 | object : java.util.TimerTask() {
45 | override fun run() {
46 | trySend(result) {
47 | throw IllegalArgumentException("Error from Kotlin 2!")
48 | }
49 | }
50 | },
51 | 1000
52 | )
53 | }
54 |
55 | val timers = mutableMapOf()
56 |
57 | /*
58 | Any method that is suffixed with `OnListen` is treated as a stream method.
59 |
60 | When a new stream is created from dart, this method is called.
61 | You can use `sink` to send events through the stream.
62 |
63 | `id` is the `hashCode` of the accompanying `StreamController` (on dart side).
64 | It is provided as a way to differentiate between streams.
65 | */
66 | fun counterOnListen(id: Int, args: Any?, sink: EventSink) {
67 | var count = 0
68 | timers[id] = timer(
69 | period = (args as Int).toLong(),
70 | action = {
71 | sink.success(count)
72 |
73 | if (count >= 100) {
74 | sink.endOfStream()
75 | cancel()
76 | }
77 |
78 | count += 1
79 | }
80 | )
81 | }
82 |
83 | /*
84 | Stream methods are only accepted if they are accompanied with an `*OnCancel()` method.
85 |
86 | Use this to tear-down any resources that might have been allocated during `*onListen()`
87 | */
88 | fun counterOnCancel(id: Int, args: Any?) {
89 | timers[id]?.cancel()
90 | timers.remove(id)
91 | }
92 |
93 | /* Exceptions are piped in streams just as well */
94 | fun brokenStream1OnListen(id: Int, args: Any?, sink: EventSink) {
95 | throw IllegalArgumentException("Error from Kotlin 3!")
96 | }
97 |
98 | /* Again, this is required for `brokenStream1` to be accepted as a stream */
99 | fun brokenStream1OnCancel(id: Int, args: Any?) {}
100 |
101 | fun brokenStream2OnListen(id: Int, args: Any?, sink: EventSink) {
102 | trySend(sink) {
103 | throw IllegalArgumentException("Error from Kotlin 4!")
104 | }
105 | }
106 |
107 | fun brokenStream2OnCancel(id: Int, args: Any?) {}
108 | }
109 |
110 | class MainActivity : FlutterActivity() {
111 | override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
112 | GeneratedPluginRegistrant.registerWith(flutterEngine);
113 |
114 | createPluginScaffold(
115 | flutterEngine.dartExecutor.binaryMessenger,
116 | "myFancyChannel",
117 | MyPlugin()
118 | )
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.3.50'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.5.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.enableR8=true
3 | android.useAndroidX=true
4 | android.enableJetifier=true
5 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
7 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '9.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def parse_KV_file(file, separator='=')
14 | file_abs_path = File.expand_path(file)
15 | if !File.exists? file_abs_path
16 | return [];
17 | end
18 | generated_key_values = {}
19 | skip_line_start_symbols = ["#", "/"]
20 | File.foreach(file_abs_path) do |line|
21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
22 | plugin = line.split(pattern=separator)
23 | if plugin.length == 2
24 | podname = plugin[0].strip()
25 | path = plugin[1].strip()
26 | podpath = File.expand_path("#{path}", file_abs_path)
27 | generated_key_values[podname] = podpath
28 | else
29 | puts "Invalid plugin specification: #{line}"
30 | end
31 | end
32 | generated_key_values
33 | end
34 |
35 | target 'Runner' do
36 | use_frameworks!
37 | use_modular_headers!
38 |
39 | # Flutter Pod
40 |
41 | copied_flutter_dir = File.join(__dir__, 'Flutter')
42 | copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework')
43 | copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec')
44 | unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path)
45 | # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet.
46 | # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration.
47 | # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist.
48 |
49 | generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig')
50 | unless File.exist?(generated_xcode_build_settings_path)
51 | raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first"
52 | end
53 | generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path)
54 | cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR'];
55 |
56 | unless File.exist?(copied_framework_path)
57 | FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir)
58 | end
59 | unless File.exist?(copied_podspec_path)
60 | FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir)
61 | end
62 | end
63 |
64 | # Keep pod path relative so it can be checked into Podfile.lock.
65 | pod 'Flutter', :path => 'Flutter'
66 |
67 | # Plugin Pods
68 |
69 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
70 | # referring to absolute paths on developers' machines.
71 | system('rm -rf .symlinks')
72 | system('mkdir -p .symlinks/plugins')
73 | plugin_pods = parse_KV_file('../.flutter-plugins')
74 | plugin_pods.each do |name, path|
75 | symlink = File.join('.symlinks', 'plugins', name)
76 | File.symlink(path, symlink)
77 | pod name, :path => File.join(symlink, 'ios')
78 | end
79 | end
80 |
81 | # Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system.
82 | install! 'cocoapods', :disable_input_output_paths => true
83 |
84 | post_install do |installer|
85 | installer.pods_project.targets.each do |target|
86 | target.build_configurations.each do |config|
87 | config.build_settings['ENABLE_BITCODE'] = 'NO'
88 | end
89 | end
90 | end
91 |
--------------------------------------------------------------------------------
/example/ios/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - Flutter (1.0.0)
3 | - plugin_scaffold (0.0.1):
4 | - Flutter
5 |
6 | DEPENDENCIES:
7 | - Flutter (from `Flutter`)
8 | - plugin_scaffold (from `.symlinks/plugins/plugin_scaffold/ios`)
9 |
10 | EXTERNAL SOURCES:
11 | Flutter:
12 | :path: Flutter
13 | plugin_scaffold:
14 | :path: ".symlinks/plugins/plugin_scaffold/ios"
15 |
16 | SPEC CHECKSUMS:
17 | Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
18 | plugin_scaffold: f83b8103defd141436d8ee29ba4a3e1b5230fea1
19 |
20 | PODFILE CHECKSUM: 1b66dae606f75376c5f2135a8290850eeb09ae83
21 |
22 | COCOAPODS: 1.8.4
23 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 1B80F5DD67113C11D0106DBC /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE641F7E98B12CEAE3491202 /* Pods_Runner.framework */; };
12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
15 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
16 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
17 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
18 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
19 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
20 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
21 | /* End PBXBuildFile section */
22 |
23 | /* Begin PBXCopyFilesBuildPhase section */
24 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
25 | isa = PBXCopyFilesBuildPhase;
26 | buildActionMask = 2147483647;
27 | dstPath = "";
28 | dstSubfolderSpec = 10;
29 | files = (
30 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
31 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
32 | );
33 | name = "Embed Frameworks";
34 | runOnlyForDeploymentPostprocessing = 0;
35 | };
36 | /* End PBXCopyFilesBuildPhase section */
37 |
38 | /* Begin PBXFileReference section */
39 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
40 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
41 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
42 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
43 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
44 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
45 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
46 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
47 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
48 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
49 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
50 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
51 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
52 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
53 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
54 | A5F46F2FE5A7E4FA13019475 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; };
55 | CE641F7E98B12CEAE3491202 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
56 | E46F9116605A68D896DE92C5 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; };
57 | EEBABD76C40B338B4288FFD6 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; };
58 | /* End PBXFileReference section */
59 |
60 | /* Begin PBXFrameworksBuildPhase section */
61 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
62 | isa = PBXFrameworksBuildPhase;
63 | buildActionMask = 2147483647;
64 | files = (
65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
67 | 1B80F5DD67113C11D0106DBC /* Pods_Runner.framework in Frameworks */,
68 | );
69 | runOnlyForDeploymentPostprocessing = 0;
70 | };
71 | /* End PBXFrameworksBuildPhase section */
72 |
73 | /* Begin PBXGroup section */
74 | 8CBB921555F898DD2D699541 /* Frameworks */ = {
75 | isa = PBXGroup;
76 | children = (
77 | CE641F7E98B12CEAE3491202 /* Pods_Runner.framework */,
78 | );
79 | name = Frameworks;
80 | sourceTree = "";
81 | };
82 | 9740EEB11CF90186004384FC /* Flutter */ = {
83 | isa = PBXGroup;
84 | children = (
85 | 3B80C3931E831B6300D905FE /* App.framework */,
86 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
87 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
88 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
89 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
90 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
91 | );
92 | name = Flutter;
93 | sourceTree = "";
94 | };
95 | 97C146E51CF9000F007C117D = {
96 | isa = PBXGroup;
97 | children = (
98 | 9740EEB11CF90186004384FC /* Flutter */,
99 | 97C146F01CF9000F007C117D /* Runner */,
100 | 97C146EF1CF9000F007C117D /* Products */,
101 | DB89FE1FAD46DE2D2072D146 /* Pods */,
102 | 8CBB921555F898DD2D699541 /* Frameworks */,
103 | );
104 | sourceTree = "";
105 | };
106 | 97C146EF1CF9000F007C117D /* Products */ = {
107 | isa = PBXGroup;
108 | children = (
109 | 97C146EE1CF9000F007C117D /* Runner.app */,
110 | );
111 | name = Products;
112 | sourceTree = "";
113 | };
114 | 97C146F01CF9000F007C117D /* Runner */ = {
115 | isa = PBXGroup;
116 | children = (
117 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
118 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
119 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
120 | 97C147021CF9000F007C117D /* Info.plist */,
121 | 97C146F11CF9000F007C117D /* Supporting Files */,
122 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
123 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
124 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
125 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
126 | );
127 | path = Runner;
128 | sourceTree = "";
129 | };
130 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
131 | isa = PBXGroup;
132 | children = (
133 | );
134 | name = "Supporting Files";
135 | sourceTree = "";
136 | };
137 | DB89FE1FAD46DE2D2072D146 /* Pods */ = {
138 | isa = PBXGroup;
139 | children = (
140 | E46F9116605A68D896DE92C5 /* Pods-Runner.debug.xcconfig */,
141 | EEBABD76C40B338B4288FFD6 /* Pods-Runner.release.xcconfig */,
142 | A5F46F2FE5A7E4FA13019475 /* Pods-Runner.profile.xcconfig */,
143 | );
144 | name = Pods;
145 | path = Pods;
146 | sourceTree = "";
147 | };
148 | /* End PBXGroup section */
149 |
150 | /* Begin PBXNativeTarget section */
151 | 97C146ED1CF9000F007C117D /* Runner */ = {
152 | isa = PBXNativeTarget;
153 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
154 | buildPhases = (
155 | 312F387D127A65191A2CDD2B /* [CP] Check Pods Manifest.lock */,
156 | 9740EEB61CF901F6004384FC /* Run Script */,
157 | 97C146EA1CF9000F007C117D /* Sources */,
158 | 97C146EB1CF9000F007C117D /* Frameworks */,
159 | 97C146EC1CF9000F007C117D /* Resources */,
160 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
161 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
162 | B1FBAA79367BC8BDF0D78095 /* [CP] Embed Pods Frameworks */,
163 | );
164 | buildRules = (
165 | );
166 | dependencies = (
167 | );
168 | name = Runner;
169 | productName = Runner;
170 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
171 | productType = "com.apple.product-type.application";
172 | };
173 | /* End PBXNativeTarget section */
174 |
175 | /* Begin PBXProject section */
176 | 97C146E61CF9000F007C117D /* Project object */ = {
177 | isa = PBXProject;
178 | attributes = {
179 | LastUpgradeCheck = 1020;
180 | ORGANIZATIONNAME = "The Chromium Authors";
181 | TargetAttributes = {
182 | 97C146ED1CF9000F007C117D = {
183 | CreatedOnToolsVersion = 7.3.1;
184 | LastSwiftMigration = 1100;
185 | };
186 | };
187 | };
188 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
189 | compatibilityVersion = "Xcode 3.2";
190 | developmentRegion = en;
191 | hasScannedForEncodings = 0;
192 | knownRegions = (
193 | en,
194 | Base,
195 | );
196 | mainGroup = 97C146E51CF9000F007C117D;
197 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
198 | projectDirPath = "";
199 | projectRoot = "";
200 | targets = (
201 | 97C146ED1CF9000F007C117D /* Runner */,
202 | );
203 | };
204 | /* End PBXProject section */
205 |
206 | /* Begin PBXResourcesBuildPhase section */
207 | 97C146EC1CF9000F007C117D /* Resources */ = {
208 | isa = PBXResourcesBuildPhase;
209 | buildActionMask = 2147483647;
210 | files = (
211 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
212 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
213 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
214 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
215 | );
216 | runOnlyForDeploymentPostprocessing = 0;
217 | };
218 | /* End PBXResourcesBuildPhase section */
219 |
220 | /* Begin PBXShellScriptBuildPhase section */
221 | 312F387D127A65191A2CDD2B /* [CP] Check Pods Manifest.lock */ = {
222 | isa = PBXShellScriptBuildPhase;
223 | buildActionMask = 2147483647;
224 | files = (
225 | );
226 | inputFileListPaths = (
227 | );
228 | inputPaths = (
229 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
230 | "${PODS_ROOT}/Manifest.lock",
231 | );
232 | name = "[CP] Check Pods Manifest.lock";
233 | outputFileListPaths = (
234 | );
235 | outputPaths = (
236 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
237 | );
238 | runOnlyForDeploymentPostprocessing = 0;
239 | shellPath = /bin/sh;
240 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
241 | showEnvVarsInLog = 0;
242 | };
243 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
244 | isa = PBXShellScriptBuildPhase;
245 | buildActionMask = 2147483647;
246 | files = (
247 | );
248 | inputPaths = (
249 | );
250 | name = "Thin Binary";
251 | outputPaths = (
252 | );
253 | runOnlyForDeploymentPostprocessing = 0;
254 | shellPath = /bin/sh;
255 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
256 | };
257 | 9740EEB61CF901F6004384FC /* Run Script */ = {
258 | isa = PBXShellScriptBuildPhase;
259 | buildActionMask = 2147483647;
260 | files = (
261 | );
262 | inputPaths = (
263 | );
264 | name = "Run Script";
265 | outputPaths = (
266 | );
267 | runOnlyForDeploymentPostprocessing = 0;
268 | shellPath = /bin/sh;
269 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
270 | };
271 | B1FBAA79367BC8BDF0D78095 /* [CP] Embed Pods Frameworks */ = {
272 | isa = PBXShellScriptBuildPhase;
273 | buildActionMask = 2147483647;
274 | files = (
275 | );
276 | inputPaths = (
277 | );
278 | name = "[CP] Embed Pods Frameworks";
279 | outputPaths = (
280 | );
281 | runOnlyForDeploymentPostprocessing = 0;
282 | shellPath = /bin/sh;
283 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
284 | showEnvVarsInLog = 0;
285 | };
286 | /* End PBXShellScriptBuildPhase section */
287 |
288 | /* Begin PBXSourcesBuildPhase section */
289 | 97C146EA1CF9000F007C117D /* Sources */ = {
290 | isa = PBXSourcesBuildPhase;
291 | buildActionMask = 2147483647;
292 | files = (
293 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
294 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
295 | );
296 | runOnlyForDeploymentPostprocessing = 0;
297 | };
298 | /* End PBXSourcesBuildPhase section */
299 |
300 | /* Begin PBXVariantGroup section */
301 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
302 | isa = PBXVariantGroup;
303 | children = (
304 | 97C146FB1CF9000F007C117D /* Base */,
305 | );
306 | name = Main.storyboard;
307 | sourceTree = "";
308 | };
309 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
310 | isa = PBXVariantGroup;
311 | children = (
312 | 97C147001CF9000F007C117D /* Base */,
313 | );
314 | name = LaunchScreen.storyboard;
315 | sourceTree = "";
316 | };
317 | /* End PBXVariantGroup section */
318 |
319 | /* Begin XCBuildConfiguration section */
320 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
321 | isa = XCBuildConfiguration;
322 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
323 | buildSettings = {
324 | ALWAYS_SEARCH_USER_PATHS = NO;
325 | CLANG_ANALYZER_NONNULL = YES;
326 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
327 | CLANG_CXX_LIBRARY = "libc++";
328 | CLANG_ENABLE_MODULES = YES;
329 | CLANG_ENABLE_OBJC_ARC = YES;
330 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
331 | CLANG_WARN_BOOL_CONVERSION = YES;
332 | CLANG_WARN_COMMA = YES;
333 | CLANG_WARN_CONSTANT_CONVERSION = YES;
334 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
335 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
336 | CLANG_WARN_EMPTY_BODY = YES;
337 | CLANG_WARN_ENUM_CONVERSION = YES;
338 | CLANG_WARN_INFINITE_RECURSION = YES;
339 | CLANG_WARN_INT_CONVERSION = YES;
340 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
341 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
342 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
343 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
344 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
345 | CLANG_WARN_STRICT_PROTOTYPES = YES;
346 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
347 | CLANG_WARN_UNREACHABLE_CODE = YES;
348 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
349 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
350 | COPY_PHASE_STRIP = NO;
351 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
352 | ENABLE_NS_ASSERTIONS = NO;
353 | ENABLE_STRICT_OBJC_MSGSEND = YES;
354 | GCC_C_LANGUAGE_STANDARD = gnu99;
355 | GCC_NO_COMMON_BLOCKS = YES;
356 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
357 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
358 | GCC_WARN_UNDECLARED_SELECTOR = YES;
359 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
360 | GCC_WARN_UNUSED_FUNCTION = YES;
361 | GCC_WARN_UNUSED_VARIABLE = YES;
362 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
363 | MTL_ENABLE_DEBUG_INFO = NO;
364 | SDKROOT = iphoneos;
365 | SUPPORTED_PLATFORMS = iphoneos;
366 | TARGETED_DEVICE_FAMILY = "1,2";
367 | VALIDATE_PRODUCT = YES;
368 | };
369 | name = Profile;
370 | };
371 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
372 | isa = XCBuildConfiguration;
373 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
374 | buildSettings = {
375 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
376 | CLANG_ENABLE_MODULES = YES;
377 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
378 | ENABLE_BITCODE = NO;
379 | FRAMEWORK_SEARCH_PATHS = (
380 | "$(inherited)",
381 | "$(PROJECT_DIR)/Flutter",
382 | );
383 | INFOPLIST_FILE = Runner/Info.plist;
384 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
385 | LIBRARY_SEARCH_PATHS = (
386 | "$(inherited)",
387 | "$(PROJECT_DIR)/Flutter",
388 | );
389 | PRODUCT_BUNDLE_IDENTIFIER = com.pycampers.pluginScaffoldExample;
390 | PRODUCT_NAME = "$(TARGET_NAME)";
391 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
392 | SWIFT_VERSION = 5.0;
393 | VERSIONING_SYSTEM = "apple-generic";
394 | };
395 | name = Profile;
396 | };
397 | 97C147031CF9000F007C117D /* Debug */ = {
398 | isa = XCBuildConfiguration;
399 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
400 | buildSettings = {
401 | ALWAYS_SEARCH_USER_PATHS = NO;
402 | CLANG_ANALYZER_NONNULL = YES;
403 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
404 | CLANG_CXX_LIBRARY = "libc++";
405 | CLANG_ENABLE_MODULES = YES;
406 | CLANG_ENABLE_OBJC_ARC = YES;
407 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
408 | CLANG_WARN_BOOL_CONVERSION = YES;
409 | CLANG_WARN_COMMA = YES;
410 | CLANG_WARN_CONSTANT_CONVERSION = YES;
411 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
412 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
413 | CLANG_WARN_EMPTY_BODY = YES;
414 | CLANG_WARN_ENUM_CONVERSION = YES;
415 | CLANG_WARN_INFINITE_RECURSION = YES;
416 | CLANG_WARN_INT_CONVERSION = YES;
417 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
418 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
419 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
420 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
421 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
422 | CLANG_WARN_STRICT_PROTOTYPES = YES;
423 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
424 | CLANG_WARN_UNREACHABLE_CODE = YES;
425 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
426 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
427 | COPY_PHASE_STRIP = NO;
428 | DEBUG_INFORMATION_FORMAT = dwarf;
429 | ENABLE_STRICT_OBJC_MSGSEND = YES;
430 | ENABLE_TESTABILITY = YES;
431 | GCC_C_LANGUAGE_STANDARD = gnu99;
432 | GCC_DYNAMIC_NO_PIC = NO;
433 | GCC_NO_COMMON_BLOCKS = YES;
434 | GCC_OPTIMIZATION_LEVEL = 0;
435 | GCC_PREPROCESSOR_DEFINITIONS = (
436 | "DEBUG=1",
437 | "$(inherited)",
438 | );
439 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
440 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
441 | GCC_WARN_UNDECLARED_SELECTOR = YES;
442 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
443 | GCC_WARN_UNUSED_FUNCTION = YES;
444 | GCC_WARN_UNUSED_VARIABLE = YES;
445 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
446 | MTL_ENABLE_DEBUG_INFO = YES;
447 | ONLY_ACTIVE_ARCH = YES;
448 | SDKROOT = iphoneos;
449 | TARGETED_DEVICE_FAMILY = "1,2";
450 | };
451 | name = Debug;
452 | };
453 | 97C147041CF9000F007C117D /* Release */ = {
454 | isa = XCBuildConfiguration;
455 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
456 | buildSettings = {
457 | ALWAYS_SEARCH_USER_PATHS = NO;
458 | CLANG_ANALYZER_NONNULL = YES;
459 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
460 | CLANG_CXX_LIBRARY = "libc++";
461 | CLANG_ENABLE_MODULES = YES;
462 | CLANG_ENABLE_OBJC_ARC = YES;
463 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
464 | CLANG_WARN_BOOL_CONVERSION = YES;
465 | CLANG_WARN_COMMA = YES;
466 | CLANG_WARN_CONSTANT_CONVERSION = YES;
467 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
468 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
469 | CLANG_WARN_EMPTY_BODY = YES;
470 | CLANG_WARN_ENUM_CONVERSION = YES;
471 | CLANG_WARN_INFINITE_RECURSION = YES;
472 | CLANG_WARN_INT_CONVERSION = YES;
473 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
474 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
475 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
476 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
477 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
478 | CLANG_WARN_STRICT_PROTOTYPES = YES;
479 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
480 | CLANG_WARN_UNREACHABLE_CODE = YES;
481 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
482 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
483 | COPY_PHASE_STRIP = NO;
484 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
485 | ENABLE_NS_ASSERTIONS = NO;
486 | ENABLE_STRICT_OBJC_MSGSEND = YES;
487 | GCC_C_LANGUAGE_STANDARD = gnu99;
488 | GCC_NO_COMMON_BLOCKS = YES;
489 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
490 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
491 | GCC_WARN_UNDECLARED_SELECTOR = YES;
492 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
493 | GCC_WARN_UNUSED_FUNCTION = YES;
494 | GCC_WARN_UNUSED_VARIABLE = YES;
495 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
496 | MTL_ENABLE_DEBUG_INFO = NO;
497 | SDKROOT = iphoneos;
498 | SUPPORTED_PLATFORMS = iphoneos;
499 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
500 | TARGETED_DEVICE_FAMILY = "1,2";
501 | VALIDATE_PRODUCT = YES;
502 | };
503 | name = Release;
504 | };
505 | 97C147061CF9000F007C117D /* Debug */ = {
506 | isa = XCBuildConfiguration;
507 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
508 | buildSettings = {
509 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
510 | CLANG_ENABLE_MODULES = YES;
511 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
512 | ENABLE_BITCODE = NO;
513 | FRAMEWORK_SEARCH_PATHS = (
514 | "$(inherited)",
515 | "$(PROJECT_DIR)/Flutter",
516 | );
517 | INFOPLIST_FILE = Runner/Info.plist;
518 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
519 | LIBRARY_SEARCH_PATHS = (
520 | "$(inherited)",
521 | "$(PROJECT_DIR)/Flutter",
522 | );
523 | PRODUCT_BUNDLE_IDENTIFIER = com.pycampers.pluginScaffoldExample;
524 | PRODUCT_NAME = "$(TARGET_NAME)";
525 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
526 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
527 | SWIFT_VERSION = 5.0;
528 | VERSIONING_SYSTEM = "apple-generic";
529 | };
530 | name = Debug;
531 | };
532 | 97C147071CF9000F007C117D /* Release */ = {
533 | isa = XCBuildConfiguration;
534 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
535 | buildSettings = {
536 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
537 | CLANG_ENABLE_MODULES = YES;
538 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
539 | ENABLE_BITCODE = NO;
540 | FRAMEWORK_SEARCH_PATHS = (
541 | "$(inherited)",
542 | "$(PROJECT_DIR)/Flutter",
543 | );
544 | INFOPLIST_FILE = Runner/Info.plist;
545 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
546 | LIBRARY_SEARCH_PATHS = (
547 | "$(inherited)",
548 | "$(PROJECT_DIR)/Flutter",
549 | );
550 | PRODUCT_BUNDLE_IDENTIFIER = com.pycampers.pluginScaffoldExample;
551 | PRODUCT_NAME = "$(TARGET_NAME)";
552 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
553 | SWIFT_VERSION = 5.0;
554 | VERSIONING_SYSTEM = "apple-generic";
555 | };
556 | name = Release;
557 | };
558 | /* End XCBuildConfiguration section */
559 |
560 | /* Begin XCConfigurationList section */
561 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
562 | isa = XCConfigurationList;
563 | buildConfigurations = (
564 | 97C147031CF9000F007C117D /* Debug */,
565 | 97C147041CF9000F007C117D /* Release */,
566 | 249021D3217E4FDB00AE95B9 /* Profile */,
567 | );
568 | defaultConfigurationIsVisible = 0;
569 | defaultConfigurationName = Release;
570 | };
571 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
572 | isa = XCConfigurationList;
573 | buildConfigurations = (
574 | 97C147061CF9000F007C117D /* Debug */,
575 | 97C147071CF9000F007C117D /* Release */,
576 | 249021D4217E4FDB00AE95B9 /* Profile */,
577 | );
578 | defaultConfigurationIsVisible = 0;
579 | defaultConfigurationName = Release;
580 | };
581 | /* End XCConfigurationList section */
582 | };
583 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
584 | }
585 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 | import plugin_scaffold
4 |
5 | enum MyError: Error {
6 | case fatalError1
7 | case fatalError3
8 | case fatalError4
9 | }
10 |
11 | class MyPlugin {
12 | var timers = [Int: Timer]()
13 |
14 | func myFancyMethod(call: FlutterMethodCall, result: @escaping FlutterResult) {
15 | result("Hello from Swift!")
16 | }
17 |
18 | func myBrokenMethod(call: FlutterMethodCall, result: @escaping FlutterResult) throws {
19 | throw MyError.fatalError1
20 | }
21 |
22 | func myBrokenCallbackMethod(call: FlutterMethodCall, result: @escaping FlutterResult) throws {
23 | if #available(iOS 10.0, *) {
24 | Timer.scheduledTimer(withTimeInterval: 1, repeats: false) {_ in
25 | trySend(result) {
26 | throw NSError(domain: "Error from swift 2", code: 999)
27 | }
28 | }
29 | }
30 | }
31 |
32 | func counterOnListen(id: Int, args: Any?, sink: @escaping FlutterEventSink) {
33 | var count = 0
34 | if #available(iOS 10.0, *) {
35 | timers[id] = Timer.scheduledTimer(withTimeInterval: args as! Double / 1000, repeats: true) {
36 | sink(count)
37 | if count >= 100 {
38 | sink(FlutterEndOfEventStream)
39 | $0.invalidate()
40 | }
41 | count += 1
42 | }
43 | }
44 | }
45 |
46 | func counterOnCancel(id: Int, args: Any?) {
47 | timers[id]?.invalidate()
48 | timers.removeValue(forKey: id)
49 | }
50 |
51 | func brokenStream1OnListen(id: Int, args: Any?, sink: @escaping FlutterEventSink) throws {
52 | throw MyError.fatalError3
53 | }
54 |
55 | func brokenStream1OnCancel(id: Int, args: Any?) {}
56 |
57 | func brokenStream2OnListen(id: Int, args: Any?, sink: @escaping FlutterEventSink) {
58 | trySend(sink) { throw MyError.fatalError4 }
59 | }
60 |
61 | func brokenStream2OnCancel(id: Int, args: Any?) {}
62 | }
63 |
64 |
65 | @UIApplicationMain
66 | @objc class AppDelegate: FlutterAppDelegate {
67 | override func application(
68 | _ application: UIApplication,
69 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
70 | ) -> Bool {
71 | let messenger = window?.rootViewController as! FlutterBinaryMessenger
72 |
73 | let plugin = MyPlugin()
74 |
75 | // unfortunately, swift just isn't dynamic enough to make full-scale dynamic dispatch possible :(
76 | _ = createPluginScaffold(
77 | messenger: messenger,
78 | channelName: "myFancyChannel",
79 | methodMap: [
80 | "myFancyMethod": plugin.myFancyMethod,
81 | "myBrokenMethod": plugin.myBrokenMethod,
82 | "myBrokenCallbackMethod": plugin.myBrokenCallbackMethod,
83 | "counterOnListen": plugin.counterOnListen,
84 | "counterOnCancel": plugin.counterOnCancel,
85 | "brokenStream1OnListen": plugin.brokenStream1OnListen,
86 | "brokenStream1OnCancel": plugin.brokenStream1OnCancel,
87 | "brokenStream2OnListen": plugin.brokenStream2OnListen,
88 | "brokenStream2OnCancel": plugin.brokenStream2OnCancel,
89 | ]
90 | )
91 |
92 | GeneratedPluginRegistrant.register(with: self)
93 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
94 | }
95 | }
96 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | plugin_scaffold_example
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter/services.dart';
5 | import 'package:plugin_scaffold/plugin_scaffold.dart';
6 |
7 | void main() => runApp(MyApp());
8 |
9 | class MyApp extends StatefulWidget {
10 | @override
11 | _MyAppState createState() => _MyAppState();
12 | }
13 |
14 | final channel = MethodChannel("myFancyChannel");
15 |
16 | class _MyAppState extends State {
17 | var isWaiting = true;
18 | var returnValue;
19 | final errors = [];
20 | final counterStream1 = PluginScaffold.createStream(channel, "counter", 1000);
21 | final counterStream2 = PluginScaffold.createStream(channel, "counter", 2000);
22 |
23 | Future doLoad() async {
24 | var value;
25 | try {
26 | value = await channel.invokeMethod("myFancyMethod");
27 | } catch (e) {
28 | value = e;
29 | } finally {
30 | if (mounted) {
31 | setState(() {
32 | isWaiting = false;
33 | returnValue = value;
34 | });
35 | }
36 | }
37 |
38 | try {
39 | await channel.invokeMethod("myBrokenMethod");
40 | } catch (e) {
41 | if (!mounted) return;
42 | setState(() {
43 | errors.add(e.toString());
44 | });
45 | }
46 |
47 | try {
48 | await channel.invokeMethod("myBrokenCallbackMethod");
49 | } catch (e) {
50 | if (!mounted) return;
51 | setState(() {
52 | errors.add(e.toString());
53 | });
54 | }
55 |
56 | try {
57 | await for (final _
58 | in PluginScaffold.createStream(channel, "brokenStream1")) {}
59 | } catch (e) {
60 | if (!mounted) return;
61 | setState(() {
62 | errors.add(e.toString());
63 | });
64 | }
65 |
66 | try {
67 | await for (final _
68 | in PluginScaffold.createStream(channel, "brokenStream2")) {}
69 | } catch (e) {
70 | if (!mounted) return;
71 | setState(() {
72 | errors.add(e.toString());
73 | });
74 | }
75 | }
76 |
77 | @override
78 | void initState() {
79 | super.initState();
80 | doLoad();
81 | }
82 |
83 | @override
84 | Widget build(BuildContext context) {
85 | return MaterialApp(
86 | home: Scaffold(
87 | appBar: AppBar(
88 | title: const Text('Flutter Plugin Scaffold'),
89 | ),
90 | body: Padding(
91 | padding: const EdgeInsets.all(8.0),
92 | child: ListView(
93 | children: [
94 | Text(
95 | isWaiting
96 | ? "Waiting for reply..."
97 | : returnValue?.toString() ?? "null",
98 | ),
99 | StreamBuilder(
100 | stream: counterStream1,
101 | builder: (context, snapshot) {
102 | return Text(snapshot.data?.toString() ?? "null");
103 | },
104 | ),
105 | StreamBuilder(
106 | stream: counterStream2,
107 | builder: (context, snapshot) {
108 | return Text(snapshot.data?.toString() ?? "null");
109 | },
110 | ),
111 | if (errors != null)
112 | SingleChildScrollView(
113 | scrollDirection: Axis.horizontal,
114 | child: Column(
115 | crossAxisAlignment: CrossAxisAlignment.start,
116 | children: errors.map((it) {
117 | return Row(
118 | children: [
119 | Padding(
120 | padding: const EdgeInsets.all(8.0),
121 | child: Text(it),
122 | ),
123 | Divider(),
124 | ],
125 | );
126 | }).toList(),
127 | ),
128 | ),
129 | ],
130 | ),
131 | ),
132 | ),
133 | );
134 | }
135 | }
136 |
--------------------------------------------------------------------------------
/example/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | archive:
5 | dependency: transitive
6 | description:
7 | name: archive
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.0.11"
11 | args:
12 | dependency: transitive
13 | description:
14 | name: args
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "1.5.2"
18 | async:
19 | dependency: transitive
20 | description:
21 | name: async
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "2.4.0"
25 | boolean_selector:
26 | dependency: transitive
27 | description:
28 | name: boolean_selector
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.0.5"
32 | charcode:
33 | dependency: transitive
34 | description:
35 | name: charcode
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "1.1.2"
39 | collection:
40 | dependency: transitive
41 | description:
42 | name: collection
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "1.14.11"
46 | convert:
47 | dependency: transitive
48 | description:
49 | name: convert
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "2.1.1"
53 | crypto:
54 | dependency: transitive
55 | description:
56 | name: crypto
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "2.1.3"
60 | flutter:
61 | dependency: "direct main"
62 | description: flutter
63 | source: sdk
64 | version: "0.0.0"
65 | flutter_test:
66 | dependency: "direct dev"
67 | description: flutter
68 | source: sdk
69 | version: "0.0.0"
70 | image:
71 | dependency: transitive
72 | description:
73 | name: image
74 | url: "https://pub.dartlang.org"
75 | source: hosted
76 | version: "2.1.4"
77 | matcher:
78 | dependency: transitive
79 | description:
80 | name: matcher
81 | url: "https://pub.dartlang.org"
82 | source: hosted
83 | version: "0.12.6"
84 | meta:
85 | dependency: transitive
86 | description:
87 | name: meta
88 | url: "https://pub.dartlang.org"
89 | source: hosted
90 | version: "1.1.8"
91 | path:
92 | dependency: transitive
93 | description:
94 | name: path
95 | url: "https://pub.dartlang.org"
96 | source: hosted
97 | version: "1.6.4"
98 | pedantic:
99 | dependency: transitive
100 | description:
101 | name: pedantic
102 | url: "https://pub.dartlang.org"
103 | source: hosted
104 | version: "1.8.0+1"
105 | petitparser:
106 | dependency: transitive
107 | description:
108 | name: petitparser
109 | url: "https://pub.dartlang.org"
110 | source: hosted
111 | version: "2.4.0"
112 | plugin_scaffold:
113 | dependency: "direct main"
114 | description:
115 | path: ".."
116 | relative: true
117 | source: path
118 | version: "3.0.1"
119 | quiver:
120 | dependency: transitive
121 | description:
122 | name: quiver
123 | url: "https://pub.dartlang.org"
124 | source: hosted
125 | version: "2.0.5"
126 | sky_engine:
127 | dependency: transitive
128 | description: flutter
129 | source: sdk
130 | version: "0.0.99"
131 | source_span:
132 | dependency: transitive
133 | description:
134 | name: source_span
135 | url: "https://pub.dartlang.org"
136 | source: hosted
137 | version: "1.5.5"
138 | stack_trace:
139 | dependency: transitive
140 | description:
141 | name: stack_trace
142 | url: "https://pub.dartlang.org"
143 | source: hosted
144 | version: "1.9.3"
145 | stream_channel:
146 | dependency: transitive
147 | description:
148 | name: stream_channel
149 | url: "https://pub.dartlang.org"
150 | source: hosted
151 | version: "2.0.0"
152 | string_scanner:
153 | dependency: transitive
154 | description:
155 | name: string_scanner
156 | url: "https://pub.dartlang.org"
157 | source: hosted
158 | version: "1.0.5"
159 | term_glyph:
160 | dependency: transitive
161 | description:
162 | name: term_glyph
163 | url: "https://pub.dartlang.org"
164 | source: hosted
165 | version: "1.1.0"
166 | test_api:
167 | dependency: transitive
168 | description:
169 | name: test_api
170 | url: "https://pub.dartlang.org"
171 | source: hosted
172 | version: "0.2.11"
173 | typed_data:
174 | dependency: transitive
175 | description:
176 | name: typed_data
177 | url: "https://pub.dartlang.org"
178 | source: hosted
179 | version: "1.1.6"
180 | vector_math:
181 | dependency: transitive
182 | description:
183 | name: vector_math
184 | url: "https://pub.dartlang.org"
185 | source: hosted
186 | version: "2.0.8"
187 | xml:
188 | dependency: transitive
189 | description:
190 | name: xml
191 | url: "https://pub.dartlang.org"
192 | source: hosted
193 | version: "3.5.0"
194 | sdks:
195 | dart: ">=2.4.0 <3.0.0"
196 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: plugin_scaffold_example
2 | description: Demonstrates how to use the plugin_scaffold plugin.
3 | publish_to: 'none'
4 |
5 | environment:
6 | sdk: ">=2.2.2 <3.0.0"
7 |
8 | dependencies:
9 | flutter:
10 | sdk: flutter
11 |
12 | plugin_scaffold:
13 | path: ../
14 |
15 | dev_dependencies:
16 | flutter_test:
17 | sdk: flutter
18 |
19 | # For information on the generic Dart part of this file, see the
20 | # following page: https://www.dartlang.org/tools/pub/pubspec
21 |
22 | # The following section is specific to Flutter.
23 | flutter:
24 |
25 | # The following line ensures that the Material Icons font is
26 | # included with your application, so that you can use the icons in
27 | # the material Icons class.
28 | uses-material-design: true
29 |
30 | # To add assets to your application, add an assets section, like this:
31 | # assets:
32 | # - images/a_dot_burr.jpeg
33 | # - images/a_dot_ham.jpeg
34 |
35 | # An image asset can refer to one or more resolution-specific "variants", see
36 | # https://flutter.dev/assets-and-images/#resolution-aware.
37 |
38 | # For details regarding adding assets from package dependencies, see
39 | # https://flutter.dev/assets-and-images/#from-packages
40 |
41 | # To add custom fonts to your application, add a fonts section here,
42 | # in this "flutter" section. Each entry in this list should have a
43 | # "family" key with the font family name, and a "fonts" key with a
44 | # list giving the asset and other descriptors for the font. For
45 | # example:
46 | # fonts:
47 | # - family: Schyler
48 | # fonts:
49 | # - asset: fonts/Schyler-Regular.ttf
50 | # - asset: fonts/Schyler-Italic.ttf
51 | # style: italic
52 | # - family: Trajan Pro
53 | # fonts:
54 | # - asset: fonts/TrajanPro.ttf
55 | # - asset: fonts/TrajanPro_Bold.ttf
56 | # weight: 700
57 | #
58 | # For details regarding fonts from package dependencies,
59 | # see https://flutter.dev/custom-fonts/#from-packages
60 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | .vagrant/
3 | .sconsign.dblite
4 | .svn/
5 |
6 | .DS_Store
7 | *.swp
8 | profile
9 |
10 | DerivedData/
11 | build/
12 | GeneratedPluginRegistrant.h
13 | GeneratedPluginRegistrant.m
14 |
15 | .generated/
16 |
17 | *.pbxuser
18 | *.mode1v3
19 | *.mode2v3
20 | *.perspectivev3
21 |
22 | !default.pbxuser
23 | !default.mode1v3
24 | !default.mode2v3
25 | !default.perspectivev3
26 |
27 | xcuserdata
28 |
29 | *.moved-aside
30 |
31 | *.pyc
32 | *sync/
33 | Icon?
34 | .tags*
35 |
36 | /Flutter/Generated.xcconfig
37 | /Flutter/flutter_export_environment.sh
--------------------------------------------------------------------------------
/ios/Assets/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/scientifichackers/flutter-plugin-scaffold/a77731edfe332ac7fee1642e034aa128ee40f15d/ios/Assets/.gitkeep
--------------------------------------------------------------------------------
/ios/Classes/PluginScaffoldHelper.h:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Dev Aggarwal on 2019-05-17.
3 | //
4 |
5 | #import
6 | #import
7 |
8 |
9 | @interface PluginScaffoldHelper : NSObject
10 | + (void)tryCatch:(void (^)(void))fn
11 | onCatch:(void (^)(id))onCatch
12 | onElse:(void (^)(void))onElse;
13 | @end
14 |
--------------------------------------------------------------------------------
/ios/Classes/PluginScaffoldHelper.m:
--------------------------------------------------------------------------------
1 | //
2 | // Created by Dev Aggarwal on 2019-05-17.
3 | //
4 |
5 | #import
6 | #import
7 |
8 | @implementation PluginScaffoldHelper
9 | + (void)tryCatch:(void (^)(void))fn
10 | onCatch:(void (^)(id))onCatch
11 | onElse:(void (^)(void))onElse {
12 | @try {
13 | fn();
14 | } @catch (id e) {
15 | onCatch(e);
16 | return;
17 | }
18 | onElse();
19 | }
20 | @end
21 |
--------------------------------------------------------------------------------
/ios/Classes/PluginScaffoldPlugin.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import "PluginScaffoldHelper.h"
3 |
4 | @interface PluginScaffoldPlugin : NSObject
5 | @end
6 |
--------------------------------------------------------------------------------
/ios/Classes/PluginScaffoldPlugin.m:
--------------------------------------------------------------------------------
1 | #import "PluginScaffoldPlugin.h"
2 | #if __has_include()
3 | #import
4 | #else
5 | // Support project import fallback if the generated compatibility header
6 | // is not copied when this plugin is created as a library.
7 | // https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
8 | #import "plugin_scaffold-Swift.h"
9 | #endif
10 |
11 | @implementation PluginScaffoldPlugin
12 | + (void)registerWithRegistrar:(NSObject*)registrar {
13 | [SwiftPluginScaffoldPlugin registerWithRegistrar:registrar];
14 | }
15 | @end
16 |
--------------------------------------------------------------------------------
/ios/Classes/SwiftPluginScaffoldPlugin.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import Flutter.FlutterChannels
3 | import os.log
4 |
5 | let logTag = "PluginScaffold"
6 | let onListen = "OnListen"
7 | let onCancel = "OnCancel"
8 | let onSuccess = "onSuccess"
9 | let onError = "onError"
10 | let endOfStream = "endOfStream"
11 |
12 | typealias PluginFunc = (FlutterMethodCall, @escaping FlutterResult) -> Void
13 | typealias PluginFuncThrows = (FlutterMethodCall, @escaping FlutterResult) throws -> Void
14 | typealias OnListen = (Int, Any?, @escaping FlutterEventSink) -> Void
15 | typealias OnListenThrows = (Int, Any?, @escaping FlutterEventSink) throws -> Void
16 | typealias OnCancel = (Int, Any?) -> Void
17 | typealias OnCancelThrows = (Int, Any?) throws -> Void
18 |
19 | public class SwiftPluginScaffoldPlugin: NSObject, FlutterPlugin {
20 | public static func register(with _: FlutterPluginRegistrar) {}
21 | }
22 |
23 | public func serializeError(_ error: Any) -> FlutterError {
24 | let code = String(reflecting: error)
25 | let stacktrace = Thread.callStackSymbols.joined(separator: "\n")
26 | print("D/\(logTag): piping exception to flutter (\(code))")
27 | if let error = error as? NSException {
28 | return FlutterError(
29 | code: code,
30 | message: error.reason,
31 | details: error.callStackSymbols.joined(separator: "\n")
32 | )
33 | } else if let error = error as? NSError {
34 | return FlutterError(code: code, message: error.localizedDescription, details: stacktrace)
35 | } else if let error = error as? Error {
36 | return FlutterError(code: code, message: error.localizedDescription, details: stacktrace)
37 | } else {
38 | return FlutterError(code: code, message: nil, details: stacktrace)
39 | }
40 | }
41 |
42 | public func catchErrors(_ sendFn: @escaping (Any?) -> Void, _ fn: @escaping () throws -> Void) {
43 | PluginScaffoldHelper.tryCatch(
44 | {
45 | do {
46 | try fn()
47 | } catch {
48 | sendFn(serializeError(error))
49 | }
50 | },
51 | onCatch: {
52 | if let error = $0 {
53 | sendFn(serializeError(error))
54 | }
55 | },
56 | onElse: {}
57 | )
58 | }
59 |
60 | public func trySend(_ sendFn: @escaping (Any?) -> Void, _ fn: (() throws -> Any?)? = nil) {
61 | var value: Any?
62 | PluginScaffoldHelper.tryCatch(
63 | {
64 | do {
65 | value = try fn?()
66 | } catch {
67 | sendFn(serializeError(error))
68 | }
69 | },
70 | onCatch: {
71 | if let error = $0 {
72 | sendFn(serializeError(error))
73 | }
74 | },
75 | onElse: {
76 | sendFn(value)
77 | }
78 | )
79 | }
80 |
81 | public func trySendError(_ sendFn: @escaping (Any?) -> Void, _ error: Error) {
82 | trySend(sendFn) {
83 | throw error
84 | }
85 | }
86 |
87 | public func createPluginScaffold(messenger: FlutterBinaryMessenger, channelName: String, methodMap: [String: Any]) -> FlutterMethodChannel {
88 | let channel = FlutterMethodChannel(name: channelName, binaryMessenger: messenger)
89 |
90 | channel.setMethodCallHandler { (call: FlutterMethodCall, result: @escaping FlutterResult) in
91 | catchErrors(result) {
92 | let name = call.method
93 | let args = call.arguments
94 |
95 | guard let method = methodMap[name] else {
96 | result(FlutterMethodNotImplemented)
97 | return
98 | }
99 |
100 | if name.hasSuffix(onListen) {
101 | let streamName = name.prefix(name.count - onListen.count)
102 | let args = args as! [Any?]
103 | let hashCode = args[0] as! Int
104 | let streamArgs = args[1]
105 | let prefix = "\(streamName)/\(hashCode)"
106 |
107 | let msg = "D/\(logTag): activate stream { channel: \(channelName), stream: \(streamName), hashCode: \(hashCode), args: \(String(describing: streamArgs)) }"
108 |
109 | let sink: FlutterEventSink = { event in
110 | switch event {
111 | case let event as FlutterError:
112 | channel.invokeMethod("\(prefix)/\(onError)", arguments: [event.code, event.message, event.details])
113 | return
114 | case let event as NSObject:
115 | if event == FlutterEndOfEventStream {
116 | channel.invokeMethod("\(prefix)/\(endOfStream)", arguments: nil)
117 | return
118 | }
119 | default:
120 | break
121 | }
122 | channel.invokeMethod("\(prefix)/\(onSuccess)", arguments: event)
123 | }
124 |
125 | switch method {
126 | case let method as OnListen:
127 | print(msg)
128 | method(hashCode, streamArgs, sink)
129 | return
130 | case let method as OnListenThrows:
131 | print(msg)
132 | catchErrors(result) { try method(hashCode, streamArgs, sink) }
133 | return
134 | default:
135 | print("W/\(logTag): The method: \(method) must be of type \(OnListen.self) or \(OnListenThrows.self)")
136 | }
137 | }
138 |
139 | if name.hasSuffix(onCancel) {
140 | let streamName = name.prefix(name.count - onListen.count)
141 | let args = args as! [Any?]
142 | let hashCode = args[0] as! Int
143 | let streamArgs = args[1]
144 |
145 | let msg = "D/\(logTag): de-activate stream { channel: \(channelName), stream: \(streamName), hashCode: \(hashCode), args: \(String(describing: streamArgs)) }"
146 |
147 | switch method {
148 | case let method as OnCancel:
149 | print(msg)
150 | method(hashCode, streamArgs)
151 | return
152 | case let method as OnCancelThrows:
153 | print(msg)
154 | catchErrors(result) { try method(hashCode, streamArgs) }
155 | return
156 | default:
157 | print("W/\(logTag): The method: \(method) must be of type \(OnCancel.self) or \(OnCancelThrows.self)")
158 | }
159 | }
160 |
161 | let msg = "D/\(logTag): invoking { channel: \(channelName), method: \(name)(), args: \(String(describing: call.arguments)) }"
162 |
163 | switch method {
164 | case let method as PluginFunc:
165 | print(msg)
166 | method(call, result)
167 | return
168 | case let method as PluginFuncThrows:
169 | print(msg)
170 | catchErrors(result) { try method(call, result) }
171 | return
172 | default:
173 | print("W/\(logTag): The method: \(method) must be of type \(PluginFunc.self) or \(PluginFuncThrows.self)")
174 | }
175 |
176 | result(FlutterMethodNotImplemented)
177 | }
178 | }
179 |
180 | return channel
181 | }
182 |
--------------------------------------------------------------------------------
/ios/plugin_scaffold.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint plugin_scaffold.podspec' to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'plugin_scaffold'
7 | s.version = '0.0.1'
8 | s.summary = 'A new flutter plugin project.'
9 | s.description = <<-DESC
10 | A new flutter plugin project.
11 | DESC
12 | s.homepage = 'http://example.com'
13 | s.license = { :file => '../LICENSE' }
14 | s.author = { 'Your Company' => 'email@example.com' }
15 | s.source = { :path => '.' }
16 | s.source_files = 'Classes/**/*'
17 | s.dependency 'Flutter'
18 | s.platform = :ios, '8.0'
19 |
20 | # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
21 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
22 | s.swift_version = '5.0'
23 | end
24 |
--------------------------------------------------------------------------------
/lib/plugin_scaffold.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/services.dart';
4 |
5 | typedef void MethodCallHandler(dynamic args);
6 |
7 | class PluginScaffold {
8 | static const onListen = "OnListen";
9 | static const onCancel = "OnCancel";
10 | static const onSuccess = "onSuccess";
11 | static const onError = "onError";
12 | static const endOfStream = "endOfStream";
13 |
14 | static final callHandlers = >{};
15 |
16 | static String getCallHandlerKey(MethodChannel channel, String methodName) {
17 | return "${channel.name}/$methodName";
18 | }
19 |
20 | static void _setChannelCallHandler(MethodChannel channel) {
21 | channel.setMethodCallHandler((call) async {
22 | final key = getCallHandlerKey(channel, call.method);
23 | final handlers = callHandlers[key];
24 | for (var handler in handlers) {
25 | handler(call.arguments);
26 | }
27 | });
28 | }
29 |
30 | static void addCallHandler(
31 | MethodChannel channel,
32 | String methodName,
33 | MethodCallHandler handler,
34 | ) {
35 | final key = getCallHandlerKey(channel, methodName);
36 | callHandlers.putIfAbsent(key, () => {});
37 | callHandlers[key].add(handler);
38 | _setChannelCallHandler(channel);
39 | }
40 |
41 | static void setCallHandler(
42 | MethodChannel channel,
43 | String methodName,
44 | MethodCallHandler handler,
45 | ) {
46 | final key = getCallHandlerKey(channel, methodName);
47 | callHandlers[key] = {handler};
48 | _setChannelCallHandler(channel);
49 | }
50 |
51 | static void removeCallHandler(MethodCallHandler handler) {
52 | for (final it in callHandlers.values) {
53 | it.remove(handler);
54 | }
55 | }
56 |
57 | static void removeCallHandlersWithName(
58 | MethodChannel channel,
59 | String methodName,
60 | ) {
61 | callHandlers.remove(getCallHandlerKey(channel, methodName));
62 | }
63 |
64 | static Stream createStream(
65 | MethodChannel channel,
66 | String streamName, [
67 | dynamic args,
68 | ]) {
69 | return createStreamController(channel, streamName, args).stream;
70 | }
71 |
72 | static StreamController createStreamController(
73 | MethodChannel channel,
74 | String streamName, [
75 | dynamic args,
76 | ]) {
77 | StreamController controller;
78 | controller = StreamController.broadcast(
79 | onListen: () async {
80 | final hashCode = controller.hashCode;
81 | final prefix = '$streamName/$hashCode';
82 |
83 | setCallHandler(channel, "$prefix/$onSuccess", (event) {
84 | controller.add(event);
85 | });
86 | setCallHandler(channel, "$prefix/$onError", (err) {
87 | controller.addError(
88 | PlatformException(code: err[0], message: err[1], details: err[2]),
89 | );
90 | });
91 | setCallHandler(channel, "$prefix/$endOfStream", (_) {
92 | controller.close();
93 | });
94 |
95 | try {
96 | await channel.invokeMethod(streamName + onListen, [hashCode, args]);
97 | } catch (e, trace) {
98 | controller.addError(e, trace);
99 | }
100 | },
101 | onCancel: () async {
102 | final hashCode = controller.hashCode;
103 | final prefix = '$streamName/$hashCode';
104 |
105 | removeCallHandlersWithName(channel, "$prefix/$onSuccess");
106 | removeCallHandlersWithName(channel, "$prefix/$onError");
107 | removeCallHandlersWithName(channel, "$prefix/$endOfStream");
108 |
109 | try {
110 | await channel.invokeMethod(streamName + onCancel, [hashCode, args]);
111 | } catch (e, trace) {
112 | controller.addError(e, trace);
113 | }
114 | },
115 | );
116 | return controller;
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/pubspec.lock:
--------------------------------------------------------------------------------
1 | # Generated by pub
2 | # See https://dart.dev/tools/pub/glossary#lockfile
3 | packages:
4 | archive:
5 | dependency: transitive
6 | description:
7 | name: archive
8 | url: "https://pub.dartlang.org"
9 | source: hosted
10 | version: "2.0.11"
11 | args:
12 | dependency: transitive
13 | description:
14 | name: args
15 | url: "https://pub.dartlang.org"
16 | source: hosted
17 | version: "1.5.2"
18 | async:
19 | dependency: transitive
20 | description:
21 | name: async
22 | url: "https://pub.dartlang.org"
23 | source: hosted
24 | version: "2.4.0"
25 | boolean_selector:
26 | dependency: transitive
27 | description:
28 | name: boolean_selector
29 | url: "https://pub.dartlang.org"
30 | source: hosted
31 | version: "1.0.5"
32 | charcode:
33 | dependency: transitive
34 | description:
35 | name: charcode
36 | url: "https://pub.dartlang.org"
37 | source: hosted
38 | version: "1.1.2"
39 | collection:
40 | dependency: transitive
41 | description:
42 | name: collection
43 | url: "https://pub.dartlang.org"
44 | source: hosted
45 | version: "1.14.11"
46 | convert:
47 | dependency: transitive
48 | description:
49 | name: convert
50 | url: "https://pub.dartlang.org"
51 | source: hosted
52 | version: "2.1.1"
53 | crypto:
54 | dependency: transitive
55 | description:
56 | name: crypto
57 | url: "https://pub.dartlang.org"
58 | source: hosted
59 | version: "2.1.3"
60 | flutter:
61 | dependency: "direct main"
62 | description: flutter
63 | source: sdk
64 | version: "0.0.0"
65 | flutter_test:
66 | dependency: "direct dev"
67 | description: flutter
68 | source: sdk
69 | version: "0.0.0"
70 | image:
71 | dependency: transitive
72 | description:
73 | name: image
74 | url: "https://pub.dartlang.org"
75 | source: hosted
76 | version: "2.1.4"
77 | matcher:
78 | dependency: transitive
79 | description:
80 | name: matcher
81 | url: "https://pub.dartlang.org"
82 | source: hosted
83 | version: "0.12.6"
84 | meta:
85 | dependency: transitive
86 | description:
87 | name: meta
88 | url: "https://pub.dartlang.org"
89 | source: hosted
90 | version: "1.1.8"
91 | path:
92 | dependency: transitive
93 | description:
94 | name: path
95 | url: "https://pub.dartlang.org"
96 | source: hosted
97 | version: "1.6.4"
98 | pedantic:
99 | dependency: transitive
100 | description:
101 | name: pedantic
102 | url: "https://pub.dartlang.org"
103 | source: hosted
104 | version: "1.8.0+1"
105 | petitparser:
106 | dependency: transitive
107 | description:
108 | name: petitparser
109 | url: "https://pub.dartlang.org"
110 | source: hosted
111 | version: "2.4.0"
112 | quiver:
113 | dependency: transitive
114 | description:
115 | name: quiver
116 | url: "https://pub.dartlang.org"
117 | source: hosted
118 | version: "2.0.5"
119 | sky_engine:
120 | dependency: transitive
121 | description: flutter
122 | source: sdk
123 | version: "0.0.99"
124 | source_span:
125 | dependency: transitive
126 | description:
127 | name: source_span
128 | url: "https://pub.dartlang.org"
129 | source: hosted
130 | version: "1.5.5"
131 | stack_trace:
132 | dependency: transitive
133 | description:
134 | name: stack_trace
135 | url: "https://pub.dartlang.org"
136 | source: hosted
137 | version: "1.9.3"
138 | stream_channel:
139 | dependency: transitive
140 | description:
141 | name: stream_channel
142 | url: "https://pub.dartlang.org"
143 | source: hosted
144 | version: "2.0.0"
145 | string_scanner:
146 | dependency: transitive
147 | description:
148 | name: string_scanner
149 | url: "https://pub.dartlang.org"
150 | source: hosted
151 | version: "1.0.5"
152 | term_glyph:
153 | dependency: transitive
154 | description:
155 | name: term_glyph
156 | url: "https://pub.dartlang.org"
157 | source: hosted
158 | version: "1.1.0"
159 | test_api:
160 | dependency: transitive
161 | description:
162 | name: test_api
163 | url: "https://pub.dartlang.org"
164 | source: hosted
165 | version: "0.2.11"
166 | typed_data:
167 | dependency: transitive
168 | description:
169 | name: typed_data
170 | url: "https://pub.dartlang.org"
171 | source: hosted
172 | version: "1.1.6"
173 | vector_math:
174 | dependency: transitive
175 | description:
176 | name: vector_math
177 | url: "https://pub.dartlang.org"
178 | source: hosted
179 | version: "2.0.8"
180 | xml:
181 | dependency: transitive
182 | description:
183 | name: xml
184 | url: "https://pub.dartlang.org"
185 | source: hosted
186 | version: "3.5.0"
187 | sdks:
188 | dart: ">=2.4.0 <3.0.0"
189 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: plugin_scaffold
2 | description: A new flutter plugin project.
3 | version: 3.1.0
4 | author: Dev Aggarwal
5 | homepage: https://github.com/pycampers/flutter-plugin-scaffold
6 |
7 | environment:
8 | sdk: ">=2.2.0 <3.0.0"
9 |
10 | dependencies:
11 | flutter:
12 | sdk: flutter
13 |
14 | dev_dependencies:
15 | flutter_test:
16 | sdk: flutter
17 |
18 | # For information on the generic Dart part of this file, see the
19 | # following page: https://www.dartlang.org/tools/pub/pubspec
20 |
21 | # The following section is specific to Flutter.
22 | flutter:
23 | # This section identifies this Flutter project as a plugin project.
24 | # The androidPackage and pluginClass identifiers should not ordinarily
25 | # be modified. They are used by the tooling to maintain consistency when
26 | # adding or updating assets for this project.
27 | plugin:
28 | androidPackage: com.pycampers.plugin_scaffold
29 | pluginClass: PluginScaffoldPlugin
30 |
31 | # To add assets to your plugin package, add an assets section, like this:
32 | # assets:
33 | # - images/a_dot_burr.jpeg
34 | # - images/a_dot_ham.jpeg
35 | #
36 | # For details regarding assets in packages, see
37 | # https://flutter.dev/assets-and-images/#from-packages
38 | #
39 | # An image asset can refer to one or more resolution-specific "variants", see
40 | # https://flutter.dev/assets-and-images/#resolution-aware.
41 |
42 | # To add custom fonts to your plugin package, add a fonts section here,
43 | # in this "flutter" section. Each entry in this list should have a
44 | # "family" key with the font family name, and a "fonts" key with a
45 | # list giving the asset and other descriptors for the font. For
46 | # example:
47 | # fonts:
48 | # - family: Schyler
49 | # fonts:
50 | # - asset: fonts/Schyler-Regular.ttf
51 | # - asset: fonts/Schyler-Italic.ttf
52 | # style: italic
53 | # - family: Trajan Pro
54 | # fonts:
55 | # - asset: fonts/TrajanPro.ttf
56 | # - asset: fonts/TrajanPro_Bold.ttf
57 | # weight: 700
58 | #
59 | # For details regarding fonts in packages, see
60 | # https://flutter.dev/custom-fonts/#from-packages
61 |
--------------------------------------------------------------------------------