Skip to content

Commit 20af90d

Browse files
Flutter plugins: update files to match Flutter SDK 3.29.3 template
According to dev-doc/packaging.md re-ran ./tool/plugin-update.sh. Skipped file changes for Windows and privacy manifests for iOS and macOS to speed up testing this. Added TODOs to remove unused method channel implementations for Linux and Windows. This enables user projects to update to Android Gradle Plugin 8.13 which has stricter checks on the compile SDK of project dependencies, like the plugins. The androidx.fragment dependency and others added by the Flutter plugin require at least SDK 34.
1 parent f438485 commit 20af90d

File tree

21 files changed

+140
-256
lines changed

21 files changed

+140
-256
lines changed

flutter_libs/.gitignore

Lines changed: 5 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# Miscellaneous
22
*.class
3-
*.lock
43
*.log
54
*.pyc
65
*.swp
76
.DS_Store
87
.atom/
8+
.build/
99
.buildlog/
1010
.history
1111
.svn/
12+
.swiftpm/
13+
migrate_working_dir/
1214

1315
# IntelliJ related
1416
*.iml
@@ -17,85 +19,13 @@
1719
.idea/
1820

1921
# Visual Studio Code related
20-
.classpath
21-
.project
22-
.settings/
2322
.vscode/
2423

25-
# packages file containing multi-root paths
26-
.packages.generated
27-
2824
# Flutter/Dart/Pub related
25+
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26+
/pubspec.lock
2927
**/doc/api/
3028
.dart_tool/
3129
.flutter-plugins
3230
.flutter-plugins-dependencies
33-
**/generated_plugin_registrant.dart
34-
.packages
35-
.pub-cache/
36-
.pub/
3731
build/
38-
flutter_*.png
39-
linked_*.ds
40-
unlinked.ds
41-
unlinked_spec.ds
42-
43-
# Android related
44-
**/android/**/gradle-wrapper.jar
45-
**/android/.gradle
46-
**/android/captures/
47-
**/android/gradlew
48-
**/android/gradlew.bat
49-
**/android/local.properties
50-
**/android/**/GeneratedPluginRegistrant.java
51-
**/android/key.properties
52-
*.jks
53-
54-
# iOS/XCode related
55-
**/ios/**/*.mode1v3
56-
**/ios/**/*.mode2v3
57-
**/ios/**/*.moved-aside
58-
**/ios/**/*.pbxuser
59-
**/ios/**/*.perspectivev3
60-
**/ios/**/*sync/
61-
**/ios/**/.sconsign.dblite
62-
**/ios/**/.tags*
63-
**/ios/**/.vagrant/
64-
**/ios/**/DerivedData/
65-
**/ios/**/Icon?
66-
**/ios/**/Pods/
67-
**/ios/**/.symlinks/
68-
**/ios/**/profile
69-
**/ios/**/xcuserdata
70-
**/ios/.generated/
71-
**/ios/Flutter/.last_build_id
72-
**/ios/Flutter/App.framework
73-
**/ios/Flutter/Flutter.framework
74-
**/ios/Flutter/Flutter.podspec
75-
**/ios/Flutter/Generated.xcconfig
76-
**/ios/Flutter/app.flx
77-
**/ios/Flutter/app.zip
78-
**/ios/Flutter/flutter_assets/
79-
**/ios/Flutter/flutter_export_environment.sh
80-
**/ios/ServiceDefinitions.json
81-
**/ios/Runner/GeneratedPluginRegistrant.*
82-
83-
# macOS
84-
**/macos/Flutter/GeneratedPluginRegistrant.swift
85-
**/macos/Flutter/Flutter-Debug.xcconfig
86-
**/macos/Flutter/Flutter-Release.xcconfig
87-
**/macos/Flutter/Flutter-Profile.xcconfig
88-
89-
# Coverage
90-
coverage/
91-
92-
# Symbols
93-
app.*.symbols
94-
95-
# Exceptions to above rules.
96-
!**/ios/**/default.mode1v3
97-
!**/ios/**/default.mode2v3
98-
!**/ios/**/default.pbxuser
99-
!**/ios/**/default.perspectivev3
100-
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
101-
!/dev/ci/**/Gemfile.lock

flutter_libs/.metadata

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
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.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 135454af32477f815a7525073027a3ff9eff1bfd
8-
channel: unknown
7+
revision: "ea121f8859e4b13e47a8f845e4586164519588bc"
8+
channel: "[user-branch]"
99

1010
project_type: plugin
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
17-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
16+
create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
17+
base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
1818
- platform: android
19-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
20-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
19+
create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
20+
base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
2121
- platform: ios
22-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
23-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
22+
create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
23+
base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
2424
- platform: linux
25-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
26-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
25+
create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
26+
base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
2727
- platform: macos
28-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
29-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
28+
create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
29+
base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
3030
- platform: windows
31-
create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
32-
base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
31+
create_revision: ea121f8859e4b13e47a8f845e4586164519588bc
32+
base_revision: ea121f8859e4b13e47a8f845e4586164519588bc
3333

3434
# User provided section
3535

flutter_libs/android/build.gradle

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
group 'io.objectbox.objectbox_flutter_libs'
2-
version '1.0-SNAPSHOT'
1+
group = "io.objectbox.objectbox_flutter_libs"
2+
version = "1.0-SNAPSHOT"
33

44
buildscript {
5-
ext.kotlin_version = '1.7.0'
5+
ext.kotlin_version = "1.8.22"
66
repositories {
77
google()
88
mavenCentral()
99
}
1010

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

@@ -21,31 +21,29 @@ allprojects {
2121
}
2222
}
2323

24-
apply plugin: 'com.android.library'
25-
apply plugin: 'kotlin-android'
24+
apply plugin: "com.android.library"
25+
apply plugin: "kotlin-android"
2626

2727
android {
28-
if (project.android.hasProperty("namespace")) {
29-
namespace 'io.objectbox.objectbox_flutter_libs'
30-
}
28+
namespace = "io.objectbox.objectbox_flutter_libs"
3129

32-
compileSdkVersion 31
30+
compileSdk = 35
3331

3432
compileOptions {
35-
sourceCompatibility JavaVersion.VERSION_1_8
36-
targetCompatibility JavaVersion.VERSION_1_8
33+
sourceCompatibility = JavaVersion.VERSION_11
34+
targetCompatibility = JavaVersion.VERSION_11
3735
}
3836

3937
kotlinOptions {
40-
jvmTarget = '1.8'
38+
jvmTarget = JavaVersion.VERSION_11
4139
}
4240

4341
sourceSets {
44-
main.java.srcDirs += 'src/main/kotlin'
42+
main.java.srcDirs += "src/main/kotlin"
4543
}
4644

4745
defaultConfig {
48-
minSdkVersion 21 // ObjectBox Android requires Android 5.0 (API level 21)
46+
minSdk = 21 // ObjectBox Android requires Android 5.0 (API level 21)
4947
}
5048

5149
dependencies {

flutter_libs/android/src/main/kotlin/io/objectbox/objectbox_flutter_libs/ObjectboxFlutterLibsPlugin.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.objectbox.objectbox_flutter_libs
22

33
import android.os.Build
4-
import androidx.annotation.NonNull
54

65
import io.flutter.embedding.engine.plugins.FlutterPlugin
76
import io.flutter.plugin.common.MethodCall
@@ -17,12 +16,12 @@ class ObjectboxFlutterLibsPlugin: FlutterPlugin, MethodCallHandler {
1716
/// when the Flutter Engine is detached from the Activity
1817
private lateinit var channel : MethodChannel
1918

20-
override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
19+
override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
2120
channel = MethodChannel(flutterPluginBinding.binaryMessenger, "objectbox_flutter_libs")
2221
channel.setMethodCallHandler(this)
2322
}
2423

25-
override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) {
24+
override fun onMethodCall(call: MethodCall, result: Result) {
2625
if (call.method == "loadObjectBoxLibrary") {
2726
// Loading the JNI library through Dart is broken on Android 6 (and maybe earlier).
2827
// Try to fix by loading it first via Java API, then again in Dart.
@@ -42,7 +41,7 @@ class ObjectboxFlutterLibsPlugin: FlutterPlugin, MethodCallHandler {
4241
}
4342
}
4443

45-
override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) {
44+
override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
4645
channel.setMethodCallHandler(null)
4746
}
4847
}

flutter_libs/ios/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ Icon?
3535

3636
/Flutter/Generated.xcconfig
3737
/Flutter/ephemeral/
38-
/Flutter/flutter_export_environment.sh
38+
/Flutter/flutter_export_environment.sh

flutter_libs/linux/CMakeLists.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@ cmake_policy(VERSION 3.10...3.24)
1414
# not be changed.
1515
set(PLUGIN_NAME "objectbox_flutter_libs_plugin")
1616

17+
# Any new source files that you add to the plugin should be added here.
18+
list(APPEND PLUGIN_SOURCES
19+
"objectbox_flutter_libs_plugin.cc"
20+
)
21+
1722
# Define the plugin library target. Its name must not be changed (see comment
1823
# on PLUGIN_NAME above).
19-
#
20-
# Any new source files that you add to the plugin should be added here.
2124
add_library(${PLUGIN_NAME} SHARED
22-
"objectbox_flutter_libs_plugin.cc"
25+
${PLUGIN_SOURCES}
2326
)
2427

2528
# Apply a standard set of build settings that are configured in the
@@ -77,6 +80,6 @@ endif()
7780
# Note: do not link the ObjectBox C library; the Dart library looks for it in a lib subfolder
7881
# where flutter build puts it when added below.
7982
set(objectbox_flutter_libs_bundled_libraries
80-
"${objectbox-download_SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX}"
81-
PARENT_SCOPE
83+
"${objectbox-download_SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}objectbox${CMAKE_SHARED_LIBRARY_SUFFIX}"
84+
PARENT_SCOPE
8285
)

flutter_libs/linux/objectbox_flutter_libs_plugin.cc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,24 @@ static void objectbox_flutter_libs_plugin_handle_method_call(
2424

2525
const gchar* method = fl_method_call_get_name(method_call);
2626

27+
// TODO Remove all methods here and also in register methods, is unused
2728
if (strcmp(method, "getPlatformVersion") == 0) {
28-
struct utsname uname_data = {};
29-
uname(&uname_data);
30-
g_autofree gchar *version = g_strdup_printf("Linux %s", uname_data.version);
31-
g_autoptr(FlValue) result = fl_value_new_string(version);
32-
response = FL_METHOD_RESPONSE(fl_method_success_response_new(result));
29+
response = get_platform_version();
3330
} else {
3431
response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
3532
}
3633

3734
fl_method_call_respond(method_call, response, nullptr);
3835
}
3936

37+
FlMethodResponse* get_platform_version() {
38+
struct utsname uname_data = {};
39+
uname(&uname_data);
40+
g_autofree gchar *version = g_strdup_printf("Linux %s", uname_data.version);
41+
g_autoptr(FlValue) result = fl_value_new_string(version);
42+
return FL_METHOD_RESPONSE(fl_method_success_response_new(result));
43+
}
44+
4045
static void objectbox_flutter_libs_plugin_dispose(GObject* object) {
4146
G_OBJECT_CLASS(objectbox_flutter_libs_plugin_parent_class)->dispose(object);
4247
}

flutter_libs/pubspec.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ homepage: https://objectbox.io
66
version: 4.3.1
77

88
environment:
9-
sdk: '>=2.18.0 <4.0.0'
10-
flutter: ">=2.5.0"
9+
sdk: ^3.7.2
10+
flutter: '>=3.3.0'
1111

1212
dependencies:
1313
flutter:
@@ -18,8 +18,7 @@ dependencies:
1818
path_provider: ^2.0.0
1919

2020
dev_dependencies:
21-
# flutter_lints 2.0.3 requires Dart 2.19, but CI still testing down to 2.18
22-
flutter_lints: '>=2.0.2 <4.0.0'
21+
flutter_lints: ^5.0.0
2322

2423
# For information on the generic Dart part of this file, see the
2524
# following page: https://dart.dev/tools/pub/pubspec

flutter_libs/windows/CMakeLists.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,23 @@ cmake_minimum_required(VERSION 3.14)
88
set(PROJECT_NAME "objectbox_flutter_libs")
99
project(${PROJECT_NAME} LANGUAGES CXX)
1010

11-
# Enable new CMake policies to avoid FetchContent deprecation warnings
12-
cmake_policy(VERSION 3.14...3.24)
11+
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
12+
# versions of CMake.
13+
cmake_policy(VERSION 3.14...3.25)
1314

1415
# This value is used when generating builds using this plugin, so it must
1516
# not be changed
1617
set(PLUGIN_NAME "objectbox_flutter_libs_plugin")
1718

19+
# Any new source files that you add to the plugin should be added here.
20+
list(APPEND PLUGIN_SOURCES
21+
"objectbox_flutter_libs_plugin.cpp"
22+
)
23+
1824
# Define the plugin library target. Its name must not be changed (see comment
1925
# on PLUGIN_NAME above).
2026
add_library(${PLUGIN_NAME} SHARED
21-
"objectbox_flutter_libs_plugin.cpp"
27+
${PLUGIN_SOURCES}
2228
)
2329

2430
# Apply a standard set of build settings that are configured in the

flutter_libs/windows/objectbox_flutter_libs_plugin.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ ObjectboxFlutterLibsPlugin::~ObjectboxFlutterLibsPlugin() {}
5656
void ObjectboxFlutterLibsPlugin::HandleMethodCall(
5757
const flutter::MethodCall<flutter::EncodableValue> &method_call,
5858
std::unique_ptr<flutter::MethodResult<flutter::EncodableValue>> result) {
59+
// TODO Remove all methods here and also in register methods, is unused
5960
if (method_call.method_name().compare("getPlatformVersion") == 0) {
6061
std::ostringstream version_stream;
6162
version_stream << "Windows ";

0 commit comments

Comments
 (0)