Skip to content

Commit 21f121d

Browse files
authored
Migrate to Flutter 3.0 (#31)
1 parent e2becce commit 21f121d

40 files changed

+834
-220
lines changed

.gitignore

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
1-
/pubspec.lock
2-
/.dart_tool/
3-
/.packages
4-
/example/pubspec.lock
5-
/example/.dart_tool/
6-
/example/.packages
7-
/doc/api/
8-
/lib/src/boringssl_ffi/libssl.so
9-
/lib/src/webcrypto_extension/libwebcrypto_extension.so
10-
/lib/src/webcrypto_extension/obj/
11-
/dart-sdk/
12-
/.vscode/
13-
/build/
14-
/android/.cxx/
15-
/notes.md
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
166
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
migrate_working_dir/
12+
13+
# IntelliJ related
14+
*.iml
15+
*.ipr
16+
*.iws
17+
.idea/
18+
19+
# The .vscode folder contains launch configuration and tasks you configure in
20+
# VS Code which you may wish to be included in version control, so this line
21+
# is commented out by default.
22+
#.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
27+
**/doc/api/
28+
.dart_tool/
29+
.packages
30+
build/

.metadata

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: 8af6b2f038c1172e61d418869363a28dffec3cb4
7+
revision: 85684f9300908116a78138ea4c6036c35c9a1236
88
channel: stable
99

1010
project_type: plugin
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
17+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
18+
- platform: android
19+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
20+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
21+
- platform: ios
22+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
23+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
24+
- platform: web
25+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
26+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
27+
28+
# User provided section
29+
30+
# List of Local paths (relative to this file) that should be
31+
# ignored by the migrate tool.
32+
#
33+
# Files that are not part of the templates will be ignored by default.
34+
unmanaged_files:
35+
- 'lib/main.dart'
36+
- 'ios/Runner.xcodeproj/project.pbxproj'

analysis_options.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
include: package:pedantic/analysis_options.yaml
15+
include: package:flutter_lints/flutter.yaml
1616
analyzer:
1717
exclude:
1818
# Cannot analyze subprojects

android/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
.DS_Store
77
/build
88
/captures
9+
.cxx

android/build.gradle

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,30 @@ group 'com.example.webcrypto'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.3.50'
5+
ext.kotlin_version = '1.6.10'
66
repositories {
77
google()
8-
jcenter()
8+
mavenCentral()
99
}
1010

1111
dependencies {
12-
classpath 'com.android.tools.build:gradle:3.5.0'
12+
classpath 'com.android.tools.build:gradle:7.1.2'
1313
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1414
}
1515
}
1616

1717
rootProject.allprojects {
1818
repositories {
1919
google()
20-
jcenter()
20+
mavenCentral()
2121
}
2222
}
2323

2424
apply plugin: 'com.android.library'
2525
apply plugin: 'kotlin-android'
2626

2727
android {
28-
compileSdkVersion 28
28+
compileSdkVersion 31
2929

3030
// We depend on cmake for the native parts.
3131
externalNativeBuild {
@@ -34,18 +34,25 @@ android {
3434
}
3535
}
3636

37+
compileOptions {
38+
sourceCompatibility JavaVersion.VERSION_1_8
39+
targetCompatibility JavaVersion.VERSION_1_8
40+
}
41+
42+
kotlinOptions {
43+
jvmTarget = '1.8'
44+
}
45+
3746
sourceSets {
3847
main.java.srcDirs += 'src/main/kotlin'
3948
}
49+
4050
defaultConfig {
4151
minSdkVersion 16
4252
ndk {
4353
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
4454
}
4555
}
46-
lintOptions {
47-
disable 'InvalidPackage'
48-
}
4956
}
5057

5158
dependencies {

android/gradle.properties

Lines changed: 0 additions & 4 deletions
This file was deleted.

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 0 additions & 5 deletions
This file was deleted.

android/src/main/kotlin/com/example/webcrypto/WebcryptoPlugin.kt

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,43 +14,25 @@
1414

1515
package com.example.webcrypto
1616

17-
import androidx.annotation.NonNull;
17+
import androidx.annotation.NonNull
1818

1919
import io.flutter.embedding.engine.plugins.FlutterPlugin
2020
import io.flutter.plugin.common.MethodCall
2121
import io.flutter.plugin.common.MethodChannel
2222
import io.flutter.plugin.common.MethodChannel.MethodCallHandler
2323
import io.flutter.plugin.common.MethodChannel.Result
24-
import io.flutter.plugin.common.PluginRegistry.Registrar
2524

2625
/** WebcryptoPlugin */
27-
public class WebcryptoPlugin: FlutterPlugin, MethodCallHandler {
26+
class WebcryptoPlugin: FlutterPlugin, MethodCallHandler {
2827
/// The MethodChannel that will the communication between Flutter and native Android
2928
///
3029
/// This local reference serves to register the plugin with the Flutter Engine and unregister it
3130
/// when the Flutter Engine is detached from the Activity
3231
private lateinit var channel : MethodChannel
3332

3433
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
35-
channel = MethodChannel(flutterPluginBinding.getFlutterEngine().getDartExecutor(), "webcrypto")
36-
channel.setMethodCallHandler(this);
37-
}
38-
39-
// This static function is optional and equivalent to onAttachedToEngine. It supports the old
40-
// pre-Flutter-1.12 Android projects. You are encouraged to continue supporting
41-
// plugin registration via this function while apps migrate to use the new Android APIs
42-
// post-flutter-1.12 via https://flutter.dev/go/android-project-migration.
43-
//
44-
// It is encouraged to share logic between onAttachedToEngine and registerWith to keep
45-
// them functionally equivalent. Only one of onAttachedToEngine or registerWith will be called
46-
// depending on the user's project. onAttachedToEngine or registerWith must both be defined
47-
// in the same class.
48-
companion object {
49-
@JvmStatic
50-
fun registerWith(registrar: Registrar) {
51-
val channel = MethodChannel(registrar.messenger(), "webcrypto")
52-
channel.setMethodCallHandler(WebcryptoPlugin())
53-
}
34+
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "webcrypto")
35+
channel.setMethodCallHandler(this)
5436
}
5537

5638
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {

example/.metadata

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,36 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: 8af6b2f038c1172e61d418869363a28dffec3cb4
7+
revision: 85684f9300908116a78138ea4c6036c35c9a1236
88
channel: stable
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
17+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
18+
- platform: android
19+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
20+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
21+
- platform: ios
22+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
23+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
24+
- platform: web
25+
create_revision: 85684f9300908116a78138ea4c6036c35c9a1236
26+
base_revision: 85684f9300908116a78138ea4c6036c35c9a1236
27+
28+
# User provided section
29+
30+
# List of Local paths (relative to this file) that should be
31+
# ignored by the migrate tool.
32+
#
33+
# Files that are not part of the templates will be ignored by default.
34+
unmanaged_files:
35+
- 'lib/main.dart'
36+
- 'ios/Runner.xcodeproj/project.pbxproj'

example/analysis_options.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
24+
rules:
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

0 commit comments

Comments
 (0)