Skip to content

Commit 91bd28f

Browse files
committed
remove scaffold getPlatformVersion across all platform plugins
`getPlatformVersion` was the example method from `flutter create --template=plugin` — a sanity-check that returns a string like "macOS 14.5.0". Nothing in this workspace nor flet itself ever called `SeriousPython.getPlatformVersion()`; the only consumers were the scaffold-generated plugin tests for Linux and Windows. Drop it everywhere before the dart-bridge release. Touches all six packages: - Top-level facade + platform-interface + method-channel impl: drop the declaration / forwarding wrapper. - Linux & Windows Dart impls: drop the override and the now-unused `methodChannel` field; trim the corresponding flutter/services and flutter/foundation imports. - Linux native plugin (C): drop the `get_platform_version()` function, collapse the method-call handler to a `NotImplemented` stub, and remove the now-orphan `<sys/utsname.h>`, `<cstring>`, and `_plugin_private.h` includes. Delete `_plugin_private.h` (only ever declared this function) and `linux/test/` (only tested this function; not referenced by CMakeLists). - Windows native plugin (C++): same shape — drop the case, the `<VersionHelpers.h>` + `<sstream>` includes, and the entire `windows/test/` scaffold. - Darwin Swift: drop the `getPlatformVersion` case; the `getResourcePath` case stays. Tighten the file docstring accordingly. - Android Java: drop the `getPlatformVersion` if-arm; `getAppVersion` / `getNativeLibraryDir` stay. flutter analyze: clean across all six packages (the 6 remaining warnings are pre-existing path-dep / missing-asset notes from local dev setup, unrelated to this change). Technically a public API break — `SeriousPython.getPlatformVersion()` is part of the published Dart API — but folded in here with the dart-bridge wire-format break already in flight.
1 parent 212efe7 commit 91bd28f

14 files changed

Lines changed: 11 additions & 199 deletions

File tree

src/serious_python/lib/serious_python.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ export 'package:serious_python_platform_interface/src/utils.dart';
99
class SeriousPython {
1010
SeriousPython._();
1111

12-
/// Returns the current name and version of the operating system.
13-
static Future<String?> getPlatformVersion() {
14-
return SeriousPythonPlatform.instance.getPlatformVersion();
15-
}
16-
1712
/// Runs Python program from an asset.
1813
///
1914
/// [assetPath] is the path to an asset which is a zip archive

src/serious_python_android/android/src/main/java/com/flet/serious_python_android/AndroidPlugin.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ public void onAttachedToActivity(@NonNull ActivityPluginBinding activityPluginBi
5858

5959
@Override
6060
public void onMethodCall(@NonNull MethodCall call, @NonNull Result result) {
61-
if (call.method.equals("getPlatformVersion")) {
62-
result.success("Android " + android.os.Build.VERSION.RELEASE);
63-
} else if (call.method.equals("getAppVersion")) {
61+
if (call.method.equals("getAppVersion")) {
6462
try {
6563
String packageName = context.getPackageName();
6664
android.content.pm.PackageManager pm = context.getPackageManager();

src/serious_python_android/lib/serious_python_android.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ class SeriousPythonAndroid extends SeriousPythonPlatform {
2626
SeriousPythonPlatform.instance = SeriousPythonAndroid();
2727
}
2828

29-
@override
30-
Future<String?> getPlatformVersion() =>
31-
methodChannel.invokeMethod<String>('getPlatformVersion');
32-
3329
@override
3430
Future<String?> run(String appPath,
3531
{String? script,

src/serious_python_darwin/darwin/Classes/SeriousPythonPlugin.swift

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ private func _sp_init_keepalive(_ data: UnsafeMutableRawPointer?) -> Int
1616
@_silgen_name("DartBridge_EnqueueMessage")
1717
private func _sp_enqueue_keepalive(_ data: UnsafePointer<CChar>?, _ len: Int)
1818

19-
/// Thin Flutter plugin: surfaces the python.bundle resource path to Dart and
20-
/// exposes the standard `getPlatformVersion`. All Python lifecycle now lives
21-
/// in `serious_python_run` (dart_bridge.xcframework), invoked from Dart.
19+
/// Thin Flutter plugin: surfaces the python.bundle resource path to Dart.
20+
/// All Python lifecycle now lives in `serious_python_run`
21+
/// (dart_bridge.xcframework), invoked from Dart.
2222
public class SeriousPythonPlugin: NSObject, FlutterPlugin {
2323

2424
public static func register(with registrar: FlutterPluginRegistrar) {
@@ -44,13 +44,6 @@ public class SeriousPythonPlugin: NSObject, FlutterPlugin {
4444

4545
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
4646
switch call.method {
47-
case "getPlatformVersion":
48-
#if os(iOS)
49-
result("iOS " + UIDevice.current.systemVersion)
50-
#else
51-
result("macOS " + ProcessInfo.processInfo.operatingSystemVersionString)
52-
#endif
53-
5447
case "getResourcePath":
5548
// The python.bundle that prepare_{ios,macos}.sh assembles ends up
5649
// inside this plugin's framework bundle as a Resources subbundle.

src/serious_python_darwin/lib/serious_python_darwin.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ class SeriousPythonDarwin extends SeriousPythonPlatform {
1717
SeriousPythonPlatform.instance = SeriousPythonDarwin();
1818
}
1919

20-
@override
21-
Future<String?> getPlatformVersion() =>
22-
methodChannel.invokeMethod<String>('getPlatformVersion');
23-
2420
@override
2521
Future<String?> run(String appPath,
2622
{String? script,

src/serious_python_linux/lib/serious_python_linux.dart

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import 'dart:io';
22

3-
import 'package:flutter/foundation.dart';
4-
import 'package:flutter/services.dart';
53
import 'package:path/path.dart' as p;
64
import 'package:serious_python_platform_interface/serious_python_platform_interface.dart';
75

@@ -20,20 +18,10 @@ import 'package:serious_python_platform_interface/serious_python_platform_interf
2018
/// doesn't have a compile-time constant for it).
2119
/// 3. Hands env + sys.path to `serious_python_run` in a single FFI call.
2220
class SeriousPythonLinux extends SeriousPythonPlatform {
23-
@visibleForTesting
24-
final methodChannel = const MethodChannel('serious_python_linux');
25-
2621
static void registerWith() {
2722
SeriousPythonPlatform.instance = SeriousPythonLinux();
2823
}
2924

30-
@override
31-
Future<String?> getPlatformVersion() async {
32-
final version =
33-
await methodChannel.invokeMethod<String>('getPlatformVersion');
34-
return '$version ${Platform.resolvedExecutable}';
35-
}
36-
3725
@override
3826
Future<String?> run(String appPath,
3927
{String? script,

src/serious_python_linux/linux/serious_python_linux_plugin.cc

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@
22

33
#include <flutter_linux/flutter_linux.h>
44
#include <gtk/gtk.h>
5-
#include <sys/utsname.h>
65

7-
#include <cstring>
8-
9-
#include "serious_python_linux_plugin_private.h"
10-
11-
// Thin Flutter plugin: only surfaces the OS version. Python lifecycle now
12-
// lives in libdart_bridge.so, invoked from Dart via FFI.
6+
// Plugin-registration shell only — all method calls return NotImplemented.
7+
// Python lifecycle lives in libdart_bridge.so, invoked from Dart via FFI.
138

149
#define SERIOUS_PYTHON_LINUX_PLUGIN(obj) \
1510
(G_TYPE_CHECK_INSTANCE_CAST((obj), serious_python_linux_plugin_get_type(), \
@@ -26,30 +21,11 @@ static void serious_python_linux_plugin_handle_method_call(
2621
SeriousPythonLinuxPlugin *self,
2722
FlMethodCall *method_call)
2823
{
29-
g_autoptr(FlMethodResponse) response = nullptr;
30-
const gchar *method = fl_method_call_get_name(method_call);
31-
32-
if (strcmp(method, "getPlatformVersion") == 0)
33-
{
34-
response = get_platform_version();
35-
}
36-
else
37-
{
38-
response = FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
39-
}
40-
24+
g_autoptr(FlMethodResponse) response =
25+
FL_METHOD_RESPONSE(fl_method_not_implemented_response_new());
4126
fl_method_call_respond(method_call, response, nullptr);
4227
}
4328

44-
FlMethodResponse *get_platform_version()
45-
{
46-
struct utsname uname_data = {};
47-
uname(&uname_data);
48-
g_autofree gchar *version = g_strdup_printf("Linux %s", uname_data.version);
49-
g_autoptr(FlValue) result = fl_value_new_string(version);
50-
return FL_METHOD_RESPONSE(fl_method_success_response_new(result));
51-
}
52-
5329
static void serious_python_linux_plugin_dispose(GObject *object)
5430
{
5531
G_OBJECT_CLASS(serious_python_linux_plugin_parent_class)->dispose(object);

src/serious_python_linux/linux/serious_python_linux_plugin_private.h

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

src/serious_python_linux/linux/test/serious_python_linux_plugin_test.cc

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

src/serious_python_platform_interface/lib/serious_python_platform_interface.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ abstract class SeriousPythonPlatform extends PlatformInterface {
2626
_instance = instance;
2727
}
2828

29-
Future<String?> getPlatformVersion() {
30-
throw UnimplementedError('platformVersion() has not been implemented.');
31-
}
32-
3329
Future<String?> run(String appPath,
3430
{String? script,
3531
List<String>? modulePaths,

0 commit comments

Comments
 (0)