Convert Java Futures to Dart Futures
- Dominant language
- Dart
- Stars
- 275
- Forks
- 144
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 52
Description
@Anikate-De Feel free to tackle this.
One design could be to include a generic`JFuture<$T extends JObject> extends JObject` in `package:jni/util/concurrent/jfuture.dart` similar to [`JList`](https://github.com/dart-lang/native/blob/main/pkgs/jni/lib/src/util/jlist.dart).
This class can have a method called `Future<$T> toDartFuture({bool releaseOriginal = false})` so we can use Dart niceties like `await` on it. I have included a way to do `toDartFuture` in https://github.com/dart-lang/native/pull/1211, with a bit of modification, you can reuse the same code.
Contributor guide
Research direction
Start by reading package:jni/util/concurrent/jfuture.dart and the JList implementation in pkgs/jni/lib/src/util/jlist.dart. Review the toDartFuture approach in pull request 1211, then define the generic JFuture API and its Future conversion. Done means the proposed Java Future wrapper supports await through toDartFuture and handles releaseOriginal as described.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, java
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100