nativeapi_flutter library

Flutter integration for nativeapi.

Re-exports package:nativeapi and adds the Flutter side: widgets, loading an image from a Flutter asset, and conversions between nativeapi's value types and dart:ui's (Offset, Size, Rect, Color, Brightness).

A few nativeapi names are not re-exported because Flutter already uses them: Brightness, Color, Display, EdgeInsets, Image and Size would silently shadow dart:ui / package:flutter, and ModifierKey, ShortcutManager, View and TextField would be ambiguous with Flutter's. Values of those types still work through this library (the conversions below, ImageAsset.fromAsset); to name one — the native View family in particular — import package:nativeapi/nativeapi.dart with a prefix:

import 'package:nativeapi/nativeapi.dart' as na;

window.setMinimumSize(const na.Size(width: 400, height: 300));
final field = na.TextField.create('');
window.contentView?.addSubview(field);

runNativeApp is left out too: it is for plain Dart programs, and a Flutter app's engine already runs the event loop.

Classes

AccessibilityManager
AppInfo
Application
ApplicationActivatedEvent
ApplicationDeactivatedEvent
ApplicationEvent
One ApplicationEvent, in its concrete form.
ApplicationExitingEvent
ApplicationQuitRequestedEvent
ApplicationStartedEvent
Button
ButtonClickedEvent
ContextMenuRegion
A widget that wraps a child and adds context menu functionality.
DeviceInfo
DisplayAddedEvent
DisplayChangedEvent
DisplayEvent
One DisplayEvent, in its concrete form.
DisplayManager
DisplayRemovedEvent
DragOutArea
Lets the user drag files or text out of child, into other applications (a file manager, an editor) or onto a DropRegion.
DragSource
DragSourceEndedEvent
DragSourceEvent
One DragSourceEvent, in its concrete form.
DragToMoveArea
A custom title-bar region that drags the window and performs the native title-bar double-click action, including the macOS user preference. A secondary click opens the native system window menu where supported (Windows, or a supporting Linux window manager): on release on Windows, as a native title bar does (the menu's modal loop would otherwise swallow the release, and Flutter would ignore the next secondary click), and on press elsewhere (a Wayland compositor accepts the request only with a press).
DragToResizeArea
Adds native resize handles over the edges and corners of child.
DropRegion
Accepts files and text dragged onto child from other applications or other windows.
DropRegionDropDetails
What was dropped on a DropRegion.
DropTarget
DropTargetDroppedEvent
DropTargetEnteredEvent
DropTargetEvent
One DropTargetEvent, in its concrete form.
DropTargetExitedEvent
DropTargetMovedEvent
EventDecision
EventRequest
FileDialog
ImageView
KeyboardAccelerator
KeyboardEvent
One KeyboardEvent, in its concrete form.
KeyboardMonitor
KeyPressedEvent
KeyReleasedEvent
Label
LaunchAtLogin
MaximizeButtonArea
Marks child, the app's own maximize button in a custom title bar, as the window's maximize button for the system.
One MenuEvent, in its concrete form.
MessageDialog
ModifierKeysChangedEvent
NotificationActivatedEvent
NotificationEvent
One NotificationEvent, in its concrete form.
NotificationManager
Point
PositioningStrategy
Preferences
Rectangle
SecureStorage
Shortcut
ShortcutActivatedEvent
ShortcutEvent
One ShortcutEvent, in its concrete form.
ShortcutOptions
ShortcutRegisteredEvent
ShortcutRegistrationFailedEvent
ShortcutUnregisteredEvent
TextFieldChangedEvent
TextFieldSubmittedEvent
TrayIcon
TrayIconClickedEvent
TrayIconDoubleClickedEvent
TrayIconEvent
One TrayIconEvent, in its concrete form.
TrayIconRightClickedEvent
TrayManager
UrlOpener
UrlOpenResult
ViewBlurredEvent
ViewEvent
One ViewEvent, in its concrete form.
ViewFocusedEvent
Window
WindowBlurredEvent
WindowClosedEvent
WindowCloseRequestedEvent
WindowCreatedEvent
WindowDragCancelledEvent
WindowDragEndedEvent
WindowDragEvent
One WindowDragEvent, in its concrete form.
WindowDragMovedEvent
WindowDragSession
WindowEnteredFullScreenEvent
WindowEvent
One WindowEvent, in its concrete form.
WindowExitedFullScreenEvent
WindowFocusedEvent
WindowManager
WindowMaximizedEvent
WindowMinimizedEvent
WindowMovedEvent
WindowOcclusionChangedEvent
WindowPropertyChangedEvent
WindowResizedEvent
WindowRestoredEvent
WindowShadow
WindowShape

Extensions

BrightnessToNative on Brightness
Converts a Flutter ui.Brightness to a nativeapi na.Brightness.
ColorToNative on Color
Converts a Flutter ui.Color to a nativeapi na.Color (8-bit channels).
ImageAsset on Image
Loading an Image from a Flutter asset.
NativeBrightnessToBrightness on Brightness
Converts a nativeapi na.Brightness to a Flutter ui.Brightness; system has no Flutter counterpart and gives null.
NativeColorToColor on Color
Converts a nativeapi na.Color (8-bit channels) to a Flutter ui.Color.
NativeSizeToSize on Size
Converts a nativeapi na.Size to a Flutter ui.Size.
OffsetToNative on Offset
Converts a Flutter ui.Offset to a nativeapi na.Point.
PointToOffset on Point
Converts a nativeapi na.Point to a Flutter ui.Offset.
RectangleToRect on Rectangle
Converts a nativeapi na.Rectangle to a Flutter ui.Rect.
RectToNative on Rect
Converts a Flutter ui.Rect to a nativeapi na.Rectangle.
SizeToNative on Size
Converts a Flutter ui.Size to a nativeapi na.Size.

Typedefs

DisplayId = int
ListenerId = int
Identifies one registered event listener.
ShortcutId = int
TrayIconId = int
ViewId = int
WindowId = int