apple_intelligence 0.3.3
apple_intelligence: ^0.3.3 copied to clipboard
Apple Intelligence for Flutter: on-device image generation streamed as it is made, plus a native text field with Writing Tools and Genmoji.
0.3.3 #
No changes to the package itself. example/lib/record.dart, which records the
README animation, had a machine-specific output directory hard-coded, and so
did tool/build_gifs.sh, which assembles its frames. Both now default to
/tmp/apple_intelligence_frames, and FRAMES_DIR changes it for both.
0.3.2 #
README only. The introduction proved "no Flutter binding for Apple Intelligence image generation" by saying a pub.flutter-io.cn search for Image Playground returns nothing. That search now returns this package, so the sentence refuted itself.
The claim still holds; it now rests on something that stays true. Every other
Apple Intelligence package on pub.flutter-io.cn is text-only, and the most installed of
them, flutter_local_ai, lists image generation as "Planned" in its own
support table.
0.3.1 #
No behaviour changes. sdk: ^3.13.0 meant Dart 3.13, which ships only with
Flutter 3.47 — released three weeks ago — so this package refused to resolve
for anyone on an older SDK. One null-aware element (Dart 3.8) was all that
required it; rewritten, the floor is now ^3.5.0 / Flutter 3.24 and verified by
type-checking against Flutter 3.16.9.
0.3.0 #
An audit of every package in this repo found six defects here.
Fixed #
import 'dart:io'made the package impossible to compile for web, while the docs promisedfallbackrendered there. Replaced withdefaultTargetPlatform.- A second concurrent
generate()silently stole the first one's events. Each run opened its ownreceiveBroadcastStream().listen, and a second listen re-sendslistento the platform, which replaces the sink — so the first stream hung forever with no error and no close. There is one subscription now, demultiplexed by the run id the native side already stamps on every event. capabilities()answered "did I configure it", not "will it work". It read backwritingToolsBehaviorandsupportsAdaptiveImageGlyph— values this plugin had set moments earlier — so it returned true on every iOS 18 device, including ones with Apple Intelligence switched off or still downloading. It is ANDed with the system's own availability flag now.- The text field ignored rebuilds.
readOnlyandfontSizewere creation-only, so a field switched to read-only stayed editable; swapping the controller left the new one attached to nothing, so every call on it did nothing at all.didUpdateWidgethandles both, with a new nativeconfigure.
Known, not fixed #
- An inserted Genmoji still cannot be read back:
getText()andonChangedgive U+FFFC where the glyph is, andsetText()removes it. A faithful round trip needs an attributed-string channel (RTFD, or per-attachment identifiers) rather than the plain-string one this uses. - On macOS the platform-view host and its
NSScrollViewretain each other, so a text field is not deallocated. Breaking it properly means restructuring the host, which is more than a patch release should carry.
0.2.2 #
exceptionFor, the internal helper that maps a platform error code to a typed exception, was public API. The barrel exported three files wholesale, and a wholesale export carries top-level functions as well as classes — so a private mapping function became something callers could reach and something that could not be changed without a breaking release. Every export now names what it exposes.- README code blocks now parse. Several listed variants one per line without terminating semicolons; each is checked through the analyser now.
Technically breaking if you were calling exceptionFor, which you had no
reason to.
0.2.1 #
Documentation only — no API or behaviour changes.
- Adds a recording of a real generation run to the README and to the pub.flutter-io.cn page. Four images in 28 seconds, each appearing as it arrived; the elapsed clock in the frames is the genuine one.
- Recording it needed a different approach from the other packages here. The
usual
flutter testframe recorder runs headless, and Apple refuses image creation to an app that is not frontmost, so the app records itself. Capture is driven by images arriving rather than by a timer, because macOS throttles timers and a stalled ticker silently truncates the run.
0.2.0 #
Writing Tools and Genmoji, via a real system text view.
AppleIntelligenceTextFieldhosts a genuineUITextView/NSTextViewinside Flutter, which is what makes Apple's text features work at all: Writing Tools attaches to aUIViewand Genmoji is a property ofUITextInput, and a Flutter text field is neither as far as the system is concerned.NativeTextControllerreads and writes the contents, andcapabilities()asks the live view what it was actually granted rather than inferring it from the OS version.onChangedfires when the native view edits itself — which is the only way to notice that Writing Tools rewrote your text or a Genmoji was inserted.
This is deliberately not a drop-in for Flutter's TextField. It is a
platform view, so it composites differently and costs more; styling does not
inherit from your theme; and it exists on iOS and macOS only, rendering
fallback elsewhere. The README says so before it says anything else about it.
Verified on macOS: the hosted view reports writingTools: true, genmoji: true,
and text round-trips through the controller.
0.1.0 #
Initial release: Apple Intelligence image generation for Flutter.
ImageCreator.generateproduces images on device with no UI, delivered as aStreamso the first can be shown while the rest are still being made. Cancelling the subscription cancels the work on the device.ImagePlaygroundSheet.presentshows Apple's own generation UI and returns the file it wrote, or null if the user cancelled.ImageCreator.availabilityreports the sheet and streaming separately, because the sheet is iOS 18.1 and streaming is 18.4 — a device can offer one and not the other.ImageConcept.textnames a subject;ImageConcept.extractedFromasks the system to find the subjects in a passage.- Errors arrive as a typed hierarchy —
OsTooOldException,GenerationUnavailableException,GenerationRefusedExceptionwith a specific reason — never as a barePlatformException.
Verified against real Apple Intelligence hardware: two PNGs of about 4 MB, the first at 6.8s and the second at 10.3s.
Not included: Writing Tools and Genmoji. Both are planned; Writing Tools attaches to a native text view while Flutter renders its own text, so it needs a design decision rather than a wrapper.
