Skip to content

Commit 848d8f3

Browse files
committed
Migrate to Flutter 2.0 null-safety part2
1 parent bd24550 commit 848d8f3

File tree

113 files changed

+1225
-1103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+1225
-1103
lines changed

Diff for: .gitignore

+9-7
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,28 @@
1717

1818
# Flutter/Dart/Pub related
1919
**/doc/api/
20+
**/ios/Flutter/.last_build_id
2021
.dart_tool/
2122
.flutter-plugins
2223
.flutter-plugins-dependencies
2324
.packages
2425
.pub-cache/
2526
.pub/
26-
pubspec.lock
2727
/build/
2828

2929
# Web related
3030
lib/generated_plugin_registrant.dart
3131

32-
# Exceptions to above rules.
33-
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
32+
# Symbolication related
33+
app.*.symbols
3434

35-
# Project exclude paths
36-
/out/
35+
# Obfuscation related
36+
app.*.map.json
3737

38-
# IDE Settings
39-
/.idea/
38+
# Android Studio will place build artifacts here
39+
/android/app/debug
40+
/android/app/profile
41+
/android/app/release
4042

4143
# Android Keystore
4244
/android/key.properties

Diff for: android/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ gradle-wrapper.jar
55
/gradlew.bat
66
/local.properties
77
GeneratedPluginRegistrant.java
8+
9+
# Remember to never publicly share your keystore.
10+
# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11+
key.properties
12+
**/*.keystore
13+
**/*.jks

Diff for: android/app/build.gradle

+18-13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ if (localPropertiesFile.exists()) {
77
}
88

99
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+
}
1013

1114
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1215
if (flutterVersionCode == null) {
@@ -29,25 +32,30 @@ if (keystorePropertiesFile.exists()) {
2932
}
3033

3134
android {
32-
compileSdkVersion 28
35+
compileSdkVersion 30
3336

34-
sourceSets {
35-
main.java.srcDirs += 'src/main/kotlin'
37+
compileOptions {
38+
sourceCompatibility JavaVersion.VERSION_1_8
39+
targetCompatibility JavaVersion.VERSION_1_8
3640
}
3741

38-
lintOptions {
39-
checkReleaseBuilds false
40-
disable 'InvalidPackage'
42+
kotlinOptions {
43+
jvmTarget = '1.8'
44+
}
45+
46+
sourceSets {
47+
main.java.srcDirs += 'src/main/kotlin'
4148
}
4249

4350
defaultConfig {
44-
applicationId "com.junghyun397.dev.virtual_flight_throttle"
51+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
52+
applicationId "com.junghyun397.vfcs"
4553
minSdkVersion 16
46-
targetSdkVersion 28
54+
targetSdkVersion 30
4755
versionCode flutterVersionCode.toInteger()
4856
versionName flutterVersionName
49-
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
5057
}
58+
5159
signingConfigs {
5260
release {
5361
keyAlias keystoreProperties['keyAlias']
@@ -56,6 +64,7 @@ android {
5664
storePassword keystoreProperties['storePassword']
5765
}
5866
}
67+
5968
buildTypes {
6069
release {
6170
signingConfig signingConfigs.release
@@ -69,8 +78,4 @@ flutter {
6978

7079
dependencies {
7180
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72-
testImplementation 'junit:junit:4.12'
73-
implementation 'androidx.multidex:multidex:2.0.1'
74-
androidTestImplementation 'androidx.test:runner:1.1.1'
75-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
7681
}

Diff for: android/app/src/debug/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.junghyun397.dev.virtual_flight_throttle">
2+
package="com.junghyun397.vfcs">
33
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>
7-
<uses-permission android:name="android.permission.VIBRATE"/>
87
</manifest>

Diff for: android/app/src/main/AndroidManifest.xml

+26-16
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,36 @@
1-
<!--suppress AndroidDomInspection -->
21
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
xmlns:tools="http://schemas.android.com/tools" package="com.junghyun397.dev.virtual_flight_throttle">
4-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
5-
calls FlutterMain.startInitialization(this); in its onCreate method.
6-
In most cases you can leave this as-is, but you if you want to provide
7-
additional functionality it is fine to subclass or reimplement
8-
FlutterApplication and put your custom class here. -->
2+
package="com.junghyun397.vfcs">
93

104
<uses-permission android:name="android.permission.INTERNET" />
115
<uses-permission android:name="android.permission.VIBRATE"/>
126

137
<application
14-
android:name="io.flutter.app.FlutterApplication"
15-
android:label="VFCS"
16-
android:icon="@mipmap/ic_launcher" tools:ignore="GoogleAppIndexingWarning">
8+
android:label="VFCS"
9+
android:icon="@mipmap/ic_launcher">
1710
<activity
18-
android:name=".MainActivity"
19-
android:launchMode="singleTop"
20-
android:theme="@style/LaunchTheme"
21-
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
22-
android:hardwareAccelerated="true"
23-
android:windowSoftInputMode="adjustResize" tools:ignore="UnusedAttribute">
11+
android:name=".MainActivity"
12+
android:launchMode="singleTop"
13+
android:theme="@style/LaunchTheme"
14+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
15+
android:hardwareAccelerated="true"
16+
android:windowSoftInputMode="adjustResize">
17+
<!-- Specifies an Android theme to apply to this Activity as soon as
18+
the Android process has started. This theme is visible to the user
19+
while the Flutter UI initializes. After that, this theme continues
20+
to determine the Window background behind the Flutter UI. -->
21+
<meta-data
22+
android:name="io.flutter.embedding.android.NormalTheme"
23+
android:resource="@style/NormalTheme"
24+
/>
25+
<!-- Displays an Android View that continues showing the launch screen
26+
Drawable until Flutter paints its first frame, then this splash
27+
screen fades out. A splash screen is useful to avoid any visual
28+
gap between the end of Android's launch screen and the painting of
29+
Flutter's first frame. -->
30+
<meta-data
31+
android:name="io.flutter.embedding.android.SplashScreenDrawable"
32+
android:resource="@drawable/launch_background"
33+
/>
2434
<intent-filter>
2535
<action android:name="android.intent.action.MAIN"/>
2636
<category android:name="android.intent.category.LAUNCHER"/>

Diff for: android/app/src/main/kotlin/com/junghyun397/dev/virtual_flight_throttle/MainActivity.kt

-12
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package com.junghyun397.vfcs
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity() {
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="?android:colorBackground" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>

Diff for: android/app/src/main/res/mipmap-hdpi/ic_launcher.png

-2.58 KB
Loading

Diff for: android/app/src/main/res/mipmap-mdpi/ic_launcher.png

-1.35 KB
Loading
-3.59 KB
Loading
-6.82 KB
Loading
-9.78 KB
Loading

Diff for: android/app/src/main/res/values-night/styles.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
5+
<!-- Show a splash screen on the activity. Automatically removed when
6+
Flutter draws its first frame -->
7+
<item name="android:windowBackground">@drawable/launch_background</item>
8+
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
18+
</resources>

Diff for: android/app/src/main/res/values/styles.xml

+11-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
45
<!-- Show a splash screen on the activity. Automatically removed when
56
Flutter draws its first frame -->
67
<item name="android:windowBackground">@drawable/launch_background</item>
78
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
818
</resources>

Diff for: android/app/src/profile/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.junghyun397.dev.virtual_flight_throttle">
2+
package="com.junghyun397.vfcs">
33
<!-- Flutter needs it to communicate with the running application
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>
7-
<uses-permission android:name="android.permission.VIBRATE"/>
87
</manifest>

Diff for: android/build.gradle

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,26 @@
11
buildscript {
2-
ext.kotlin_version = '1.4.21'
2+
ext.kotlin_version = '1.3.50'
33
repositories {
44
google()
5-
jcenter()
5+
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:4.0.1'
9+
classpath 'com.android.tools.build:gradle:4.1.0'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
1313

1414
allprojects {
1515
repositories {
1616
google()
17-
jcenter()
17+
mavenCentral()
1818
}
1919
}
2020

2121
rootProject.buildDir = '../build'
2222
subprojects {
2323
project.buildDir = "${rootProject.buildDir}/${project.name}"
24-
}
25-
subprojects {
2624
project.evaluationDependsOn(':app')
2725
}
2826

Diff for: android/gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
android.enableR8=true
32
android.useAndroidX=true
43
android.enableJetifier=true

Diff for: android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip

Diff for: android/settings.gradle

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
include ':app'
22

3-
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
3+
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4+
def properties = new Properties()
45

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-
}
6+
assert localPropertiesFile.exists()
7+
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
108

11-
plugins.each { name, path ->
12-
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13-
include ":$name"
14-
project(":$name").projectDir = pluginDirectory
15-
}
9+
def flutterSdkPath = properties.getProperty("flutter.sdk")
10+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11+
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

Diff for: android/settings_aar.gradle

-1
This file was deleted.

Diff for: ios/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
**/dgph
12
*.mode1v3
23
*.mode2v3
34
*.moved-aside
@@ -18,6 +19,7 @@ Flutter/App.framework
1819
Flutter/Flutter.framework
1920
Flutter/Flutter.podspec
2021
Flutter/Generated.xcconfig
22+
Flutter/ephemeral/
2123
Flutter/app.flx
2224
Flutter/app.zip
2325
Flutter/flutter_assets/

Diff for: ios/ExportOptions.plist

-10
This file was deleted.

Diff for: ios/Flutter/AppFrameworkInfo.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<plist version="1.0">
44
<dict>
55
<key>CFBundleDevelopmentRegion</key>
6-
<string>$(DEVELOPMENT_LANGUAGE)</string>
6+
<string>en</string>
77
<key>CFBundleExecutable</key>
88
<string>App</string>
99
<key>CFBundleIdentifier</key>
@@ -21,6 +21,6 @@
2121
<key>CFBundleVersion</key>
2222
<string>1.0</string>
2323
<key>MinimumOSVersion</key>
24-
<string>8.0</string>
24+
<string>9.0</string>
2525
</dict>
2626
</plist>

0 commit comments

Comments
 (0)