Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## [1.0.0] - 28/01/2026

- Updated to Flutter 3.x and Dart 3.x.
- Migrated from `package_info` to `package_info_plus`.
- Updated `url_launcher` and `in_app_update` to latest versions.
- Migrated Android build system to the new declarative Gradle plugin system.
- Updated Android compileSdk and targetSdk to 35.
- Migrated Android to Java 17 and Kotlin 2.1.0.
- Improved code quality with `const` constructors and modern Flutter best practices.
- Fixed `Unresolved reference: io` and other migration-related build errors.

## [0.1.1] - 19/12/2021

- Keeping dependencies up-to-date
Expand Down
63 changes: 0 additions & 63 deletions example/android/app/build.gradle

This file was deleted.

43 changes: 43 additions & 0 deletions example/android/app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
id("com.android.application")
id("kotlin-android")
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id("dev.flutter.flutter-gradle-plugin")
}

android {
namespace = "com.example.package_tester"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11.toString()
}

defaultConfig {
applicationId = "com.example.package_tester"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.getByName("debug")
}
}
}

flutter {
source = "../.."
}
25 changes: 2 additions & 23 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,45 +1,24 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.package_tester">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:name="io.flutter.app.FlutterApplication"
android:label="Your App"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ package com.example.package_tester

import io.flutter.embedding.android.FlutterActivity

class MainActivity: FlutterActivity() {
}
class MainActivity: FlutterActivity()
31 changes: 0 additions & 31 deletions example/android/build.gradle

This file was deleted.

21 changes: 21 additions & 0 deletions example/android/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
allprojects {
repositories {
google()
mavenCentral()
}
}

val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get()
rootProject.layout.buildDirectory.value(newBuildDir)

subprojects {
val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name)
project.layout.buildDirectory.value(newSubprojectBuildDir)
}
subprojects {
project.evaluationDependsOn(":app")
}

tasks.register<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
4 changes: 2 additions & 2 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError
android.useAndroidX=true
android.enableJetifier=true

3 changes: 1 addition & 2 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip
15 changes: 0 additions & 15 deletions example/android/settings.gradle

This file was deleted.

25 changes: 25 additions & 0 deletions example/android/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
pluginManagement {
val flutterSdkPath = run {
val properties = java.util.Properties()
file("local.properties").inputStream().use { properties.load(it) }
val flutterSdkPath = properties.getProperty("flutter.sdk")
require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" }
flutterSdkPath
}

includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.13.1" apply false
id("org.jetbrains.kotlin.android") version "2.2.21" apply false
}

include(":app")
11 changes: 7 additions & 4 deletions example/lib/dio.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class _HomeState extends State<Home> {
/// For example: You got status code of 412 from the
/// response of HTTP request.
/// Let's say the statusCode 412 requires you to force update
Future.delayed(Duration.zero, () {
Future.delayed(Duration.zero, () async {
if (statusCode == HttpStatus.unauthorized) {
NativeUpdater.displayUpdateAlert(
await NativeUpdater.displayUpdateAlert(
context,
forceUpdate: true,
appStoreUrl: '<Your App Store URL>',
Expand Down Expand Up @@ -61,9 +61,12 @@ class _HomeState extends State<Home> {
));

try {
Response response = await dio.get('/get');
await dio.get('/get');
} on DioError catch (e) {
checkVersion(e.response.statusCode);
var code = e.response?.statusCode;
if(code != null){
checkVersion(code);
}
}
}
}
6 changes: 3 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ class _HomeState extends State<Home> {
/// This could get from the API
int serverLatestVersion = 10;

Future.delayed(Duration.zero, () {
Future.delayed(Duration.zero, () async {
if (statusCode == 412) {
NativeUpdater.displayUpdateAlert(
await NativeUpdater.displayUpdateAlert(
context,
forceUpdate: true,
appStoreUrl: '<Your App Store URL>',
Expand All @@ -51,7 +51,7 @@ class _HomeState extends State<Home> {
errorSubtitle: "This version of the app isn't legit"
);
} else if (serverLatestVersion > localVersion) {
NativeUpdater.displayUpdateAlert(
await NativeUpdater.displayUpdateAlert(
context,
forceUpdate: false,
appStoreUrl: '<Your App Store URL>',
Expand Down
Loading