Skip to content

Commit df24f74

Browse files
committed
chore: Prepare v4.2.0-rc.2
1 parent b6aee5a commit df24f74

File tree

4 files changed

+72
-6
lines changed

4 files changed

+72
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 4.2.0-rc.2
2+
3+
- New capability-base UIDriver API + docs
4+
15
## 4.2.0-rc.1
26

37
- New capability-base UIDriver API

lib/src/capabilities/native_module_capability.dart

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,59 @@ import "package:duit_kernel/duit_kernel.dart";
22
import "package:duit_kernel/src/capabilities/driver_ref.dart";
33
import "package:meta/meta.dart";
44

5+
/// A mixin that provides capabilities for managing and interacting with
6+
/// native code in the Duit UI system. Classes that mix in this delegate should
7+
/// provide concrete implementations for handling native module interactions,
8+
/// such as invoking native methods and initializing the native module.
59
mixin NativeModuleCapabilityDelegate implements DriverRefHolder {
610
@override
711
@mustBeOverridden
8-
void linkDriver(UIDriver driver) => throw const MissingCapabilityMethodImplementation(
12+
void linkDriver(UIDriver driver) =>
13+
throw const MissingCapabilityMethodImplementation(
914
"linkDriver",
1015
"NativeModuleCapabilityDelegate",
1116
);
1217

18+
/// Initializes the native module.
19+
///
20+
/// This method must be overridden by implementers.
21+
///
22+
/// Throws [MissingCapabilityMethodImplementation] if not overridden.
1323
@mustBeOverridden
14-
Future<void> initNativeModule() => throw const MissingCapabilityMethodImplementation(
24+
Future<void> initNativeModule() =>
25+
throw const MissingCapabilityMethodImplementation(
1526
"initNativeModule",
1627
"NativeModuleCapabilityDelegate",
1728
);
29+
30+
/// Invokes a native method.
31+
///
32+
/// The [method] parameter represents the name of the native method to invoke.
33+
/// The [arguments] parameter contains any additional data required for the method.
34+
///
35+
/// This method must be overridden by implementers.
36+
///
37+
/// Throws [MissingCapabilityMethodImplementation] if not overridden.
38+
@mustBeOverridden
39+
Future<T?> invokeNativeMethod<T>(
40+
String method, [
41+
arguments,
42+
]) =>
43+
throw const MissingCapabilityMethodImplementation(
44+
"invokeNativeMethod",
45+
"NativeModuleCapabilityDelegate",
46+
);
47+
48+
/// Called to clean up any external resources, subscriptions, or handlers
49+
/// typically when a delegate is being disposed of or detached. Implementations
50+
/// should ensure all open streams or event sources are closed.
51+
///
52+
/// This method must be overridden by implementers.
53+
///
54+
/// Throws [MissingCapabilityMethodImplementation] by default.
55+
@mustBeOverridden
56+
void releaseResources() => throw const MissingCapabilityMethodImplementation(
57+
"releaseResources",
58+
"NativeModuleCapabilityDelegate",
59+
);
1860
}

lib/src/capabilities/scripting_capability.dart

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,23 @@ import "package:duit_kernel/duit_kernel.dart";
22
import "package:duit_kernel/src/capabilities/driver_ref.dart";
33
import "package:meta/meta.dart";
44

5+
/// A mixin that provides capabilities for managing and run scripts in the Duit UI system.
6+
/// Classes that mix in this delegate
7+
/// should provide concrete implementations for
8+
/// handling script execution, evaluation, and initialization.
59
mixin ScriptingCapabilityDelegate implements DriverRefHolder {
610
@override
711
@mustBeOverridden
8-
void linkDriver(UIDriver driver) => throw const MissingCapabilityMethodImplementation(
12+
void linkDriver(UIDriver driver) =>
13+
throw const MissingCapabilityMethodImplementation(
914
"linkDriver",
1015
"ScriptingCapabilityDelegate",
1116
);
1217

1318
/// Eval script source code
1419
@mustBeOverridden
15-
Future<void> evalScript(String source) => throw const MissingCapabilityMethodImplementation(
20+
Future<void> evalScript(String source) =>
21+
throw const MissingCapabilityMethodImplementation(
1622
"evalScript",
1723
"ScriptingCapabilityDelegate",
1824
);
@@ -36,8 +42,22 @@ mixin ScriptingCapabilityDelegate implements DriverRefHolder {
3642

3743
/// Initializes the scripting capability.
3844
@mustBeOverridden
39-
Future<void> initScriptingCapability() => throw const MissingCapabilityMethodImplementation(
45+
Future<void> initScriptingCapability() =>
46+
throw const MissingCapabilityMethodImplementation(
4047
"initScriptingCapability",
4148
"ScriptingCapabilityDelegate",
4249
);
50+
51+
/// Called to clean up any external resources, subscriptions, or handlers
52+
/// typically when a delegate is being disposed of or detached. Implementations
53+
/// should ensure all open streams or event sources are closed.
54+
///
55+
/// This method must be overridden by implementers.
56+
///
57+
/// Throws [MissingCapabilityMethodImplementation] by default.
58+
@mustBeOverridden
59+
void releaseResources() => throw const MissingCapabilityMethodImplementation(
60+
"releaseResources",
61+
"ScriptingCapabilityDelegate",
62+
);
4363
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: duit_kernel
22
description: "Core library for flutter_duit package. Contains reusable models for developing third-party packages."
3-
version: 4.2.0-rc.1
3+
version: 4.2.0-rc.2
44
repository: https://github.com/lesleysin/duit_kernel
55
funding:
66
- https://boosty.to/duit_foundation

0 commit comments

Comments
 (0)