Loading…

Dartvel, home
Docs
Features
Studio
Cloud
Compared

Search the site

GitHub
pub.dev

GETTING STARTED

Getting started
Existing Flutter apps
Existing Native apps
Run on your phone

APP

UI and styling
Class widgets
Routing
State
Accessibility
Keyboard shortcuts
Localization
Devices and desktop
Native device access
Media, 3D and XR

DATA

Data models
Forms
Search
Sync and offline
Import and export
Change capture
Database
Cache
File storage
Images
Privacy and erasure

BACKEND

Backend functions
Auth and sessions
Authorization
Queues and jobs
Workers and memory
Notifications and mail
Outbound HTTP
AI
Webhooks
GraphQL and OpenAPI
API keys and OAuth
Multi-tenancy
Billing and commerce
Modules

OPERATIONS

Edge security
Secrets and environments
Monitoring
OpenTelemetry
Releases

SHIPPING

Build targets
Static web hosting
Servers and deploying

REFERENCE

Testing
CLI reference
Coding agents

APP

Native device access

DV.Platform is how an application reaches the device it runs on: native APIs through FFI and JNI, never platform channels.

Every getter below exists in packages/dartvel_flutter/lib/dartvel_flutter.dart. Members listed as planned have no binding yet.

ON THIS PAGE

What it is

Members

Platform support

File associations

Permissions

Beyond DV.Platform

Planned (not shipped)

What it is

DV.Platform holds the native capabilities the framework registers for the current target. A desktop binds clipboard, window controls; phones and installed web apps can open declared file types too. A browser has a different set. Calling a capability the target lacks throws a typed error that names the missing binding.

Bindings are registered through dart:ffi (Linux, Windows, macOS, embedded) or jnigen-generated JNI (Android), and through dart:js_interop with package:web (web). No MethodChannel, EventChannel or BasicMessageChannel is used anywhere.

Members

Platform identity

DV.Platform.currentPlatform   // android, ios, macos, windows, linux, web, ...
DV.Platform.isAndroid, isIOS, isWeb, isLinux, isMacOS, isWindows
DV.Platform.isTV, isWatch, isFoldable
DV.Platform.breakpoint        // desktop, tablet, mobile
DV.Platform.orientation

Copy code to clipboard

Screen and window

DV.Platform.screen.screenWidth, screenHeight
DV.Platform.screen.safeAreas
DV.Platform.window.setTitle(), .maximize(), .minimize(), .restore(), .setSize()

Copy code to clipboard

Device namespaces

Every DV.Platform member is lowerCamel, like the rest of DV.*: DV.Platform.camera, DV.Platform.window, DV.Platform.fileStorage, DV.Platform.notifications. The older capitalised names (Camera, Window, Tray, FileStorage, Notifications and the rest) still compile as @Deprecated aliases for one release. DV.Platform.notifications unifies the notifications service and device-local notifications under the standard lowerCamel convention.

DV.Platform.camera, media, location, bluetooth, nfc, clipboard, share, apps
DV.Platform.sensors, biometrics, deepLinks, haptics, contacts
DV.Platform.notifications, permissions, browserExtension, network
DV.Platform.install, display, fileStorage, device, fonts, dragDrop

Copy code to clipboard

DV.Platform.associations // opened files and picker fallback

Copy code to clipboard

Desktop-only

DV.Platform.tray, Menus, Shortcuts, Printing

Copy code to clipboard

Surface

DV.Platform.surface        // DVRenderSurface.gui or .terminal
DV.Platform.terminal
DV.Platform.useRenderSurface(...)

Copy code to clipboard

File, storage and notifications proxies

DV.Platform.fileStorage    // DV.FileStorage on the device disk
DV.Platform.notifications  // proxy to DV.Notifications & local notifications

Copy code to clipboard

Platform support

Availability per member (shipped / partial / planned). Partial means the getter exists but the underlying native binding covers only some operations or platforms.

surface

Status: Shipped

Platforms with bindings: all

terminal

Status: Shipped (opt-in)

Platforms with bindings: terminal backend linked

currentPlatform / is*

Status: Shipped

Platforms with bindings: all

breakpoint / orientation

Status: Shipped

Platforms with bindings: all

screen

Status: Shipped

Platforms with bindings: all

Window

Status: Shipped

Platforms with bindings: all (desktop controls partial)

tray

Status: Shipped

Platforms with bindings: macOS, Windows, Linux: separators, headers, check and radio marks, submenus, update in place

window.hide / .show, close-to-hide

Status: Shipped

Platforms with bindings: macOS, Windows, Linux (exitPolicy explicit)

launchAtLogin

Status: Shipped

Platforms with bindings: macOS 13+, Windows, Linux

Menus / Shortcuts / Printing

Status: Partial

Platforms with bindings: Linux, Windows, macOS bindings; availability depends on the desktop session

Dialogs

Status: Partial

Platforms with bindings: Linux, Windows, macOS native bindings

DragDrop

Status: Partial

Platforms with bindings: desktop (Linux, Windows, macOS) and the web, onto the window or one widget (.dropTarget), and dragging out of a browser page (.draggable); a dropped file is read with readBytes(). Android and iOS bridges are generated by the build and not yet run on a device

associations

Status: Partial

Platforms with bindings: build registration; opened files on Android, iOS, web and desktop arguments; device verification pending

camera

Status: Partial

Platforms with bindings: Android, some web; iOS built but not yet run on an iPhone

media

Status: Partial

Platforms with bindings: Android, some web; iOS pickers built but not yet run on an iPhone

fileStorage

Status: Shipped

Platforms with bindings: all: Android, iOS, macOS, Windows, Linux, embedded Linux, web (OPFS); pickers on Android, desktop and web

files (deprecated)

Status: Shipped

Platforms with bindings: Android, web; use fileStorage

location

Status: Partial

Platforms with bindings: Android; iOS built but not yet run on an iPhone

notifications

Status: Stub

Platforms with bindings: all

bluetooth

Status: Partial

Platforms with bindings: Android 31+, some others

nfc

Status: Partial

Platforms with bindings: isAvailable on Android and iOS; reading and writing tags planned

device

Status: Shipped (stub)

Platforms with bindings: all

clipboard

Status: Partial

Platforms with bindings: web, Linux, Windows, macOS (varies)

share

Status: Partial

Platforms with bindings: Android, web; iOS built but not yet run on an iPhone

apps

Status: Partial

Platforms with bindings: Android (list, icon, open, settings, uninstall, ask to be the home app, the default app for calls, texts, links and the camera); dartvel.android.launcher makes a home-screen app over the wallpaper, on phones and Android TV, that hears Home and Recents, reads other apps' shortcuts, hears installs as they happen, pulls the notification shade down, opens the wallpaper picker and Settings pages; dartvel.android.recentsService adds an opt-in service that shows the app's own Recents for the Recents button and can lock the screen; dartvel.android.notificationBadges counts notifications per app for badges

sensors

Status: Partial

Platforms with bindings: Android, some web; iOS built but not yet run on an iPhone

biometrics

Status: Partial

Platforms with bindings: web; canAuthenticate on Android; iOS (Face ID, Touch ID) built but not yet run on an iPhone

deepLinks

Status: Stub

Platforms with bindings: all

haptics

Status: Partial

Platforms with bindings: Android, iOS, web

contacts

Status: Partial

Platforms with bindings: Android; iOS built but not yet run on an iPhone

permissions

Status: Shipped

Platforms with bindings: all (policy framework)

browserExtension

Status: Shipped

Platforms with bindings: Chromium / Firefox extensions

network

Status: Shipped

Platforms with bindings: all (signal: online / metered / offline / unknown)

install

Status: Partial

Platforms with bindings: web (PWA)

display

Status: Shipped (stub)

Platforms with bindings: all

File associations

An application declares the file types it opens once, in dartvel.fileAssociations, and dartvel build registers them the way each target expects: the developer never edits android/, ios/, web/ or a registry by hand. Where a target only reads a file the developer owns, the build writes a marked block it replaces on every build and removes when the declaration goes away, and leaves everything outside it alone.

# pubspec.yaml
dartvel:
  fileAssociations:
    - mimeType: application/x-shop-order
      extensions: [order]
      description: Shop order
      icon: assets/order.png
      role: editor # the default; viewer for read-only
    - mimeType: application/pdf
      role: viewer

Copy code to clipboard

A project whose dartvel: names a Dart config file declares the same thing as a field of its config class. The class serialises to exactly the YAML object, with the same keys, defaults and error messages.

// dartvel_config.dart, named by `dartvel: dartvel_config.dart` in pubspec.yaml.
// Exactly the same object as the YAML: same keys, defaults and validation.
import 'package:dartvel_core/config.dart';

class const ShopConfig() extends DartvelConfig {
  @override
  List<DVFileAssociation> get fileAssociations => const <DVFileAssociation>[
        DVFileAssociation(
          mimeType: 'application/x-shop-order',
          extensions: <String>['order'],
          description: 'Shop order',
        ),
        DVFileAssociation(mimeType: 'application/pdf', role: .viewer),
      ];
}

Copy code to clipboard

Files arrive on one stream on every target, whether the app was launched with them, opened with them while running, or had them shared to it. Where nothing can open the app with a file, pick shows the platform's own picker and feeds the same stream.

// Every target delivers the same way: launched with a file, opened with one
// while running, or shared to the app.
void openOrders() {
  DV.Platform.associations.opened.listen((DVOpenedFile file) async {
    if (file.extension != 'order') return;
    final List<int> bytes = await file.read();
    DV.log('Opening ${file.name}, ${bytes.length} bytes');
  });
}

// Where nothing can open the app with a file -- a browser tab, webOS, a
// terminal build -- the picker feeds the same handler.
Future<void> openFromPicker() async {
  if (!DV.Platform.associations.canPick) return;
  await DV.Platform.associations.pick(
    types: const <DVFileType>[
      DVFileType(
        mimeType: 'application/x-shop-order',
        extensions: <String>['order'],
      ),
    ],
  );
}

Copy code to clipboard

Android

Registered with the system: open-with and share-target intent filters

How files arrive: copied to the cache, at start and on resume

iOS

Registered with the system: document types, declared types, open in place

How files arrive: copied out of their security scope, at start and on resume

macOS

Registered with the system: document types and declared types

How files arrive: launch arguments

Windows

Registered with the system: per-user registry script beside the binary

How files arrive: launch arguments

Linux, Sony eLinux

Registered with the system: .desktop MimeType and shared-mime-info

How files arrive: launch arguments

Tizen

Registered with the system: view app controls

How files arrive: picker (delivery not wired yet)

Web, installed

Registered with the system: manifest file_handlers

How files arrive: launchQueue, with the bytes

Web tab, webOS, terminal

Registered with the system: no system registration

How files arrive: picker

A type's icon is used where the platform takes one from a file: the installed web app's handler, the Linux MIME-type icon, and Windows when it is an .ico. On Apple platforms and Android a document shows the app's own icon.

On a desktop a file still also opens the /open?path= route, as before. dartvel.desktop.fileAssociations still works and warns that it has moved to dartvel.fileAssociations.

Tried so far on Linux, where a file opened from the desktop reaches the running app, and in Chrome, where a file handed to the web app arrives with its bytes. Android, iOS, macOS and Windows are generated and tested in code but not yet run on a device, and on Tizen files come in through the picker for now.

Permissions

Runtime permissions are requested through DV.Platform.permissions. The framework asks at the point the capability is first called. Each permission is mapped to a policy entry in pubspec.yaml. A refusal produces a typed error.

DV.Platform.permissions.request('microphone')

Copy code to clipboard

Permissions are per-capability

A camera call checks the camera permission; a microphone call checks the microphone permission. There is no global "allow all" prompt.

Beyond DV.Platform

DV.Platform covers what the framework registers. Going further requires native modules or direct bindings.

Native binding graph

The framework binds native APIs through FFI (C libraries: libX11, GTK, GDBus on Linux; Win32 on Windows; CoreGraphics on macOS) and through JNI (jnigen-generated bindings on Android). Each platform file in the framework lists the bindings that are registered and the ones that are deliberately absent, with the reason stated.

Platform channels / FFI

No Flutter MethodChannel is used for any native integration. All bindings go through dart:ffi or package:jni, per the native integration rule.

Platform views

Native UI that Flutter cannot render is embedded through platform views. Their lifecycle and routing are framework concerns; applications declare what they need.

DVPreferredRenderingMode

A planned feature: selecting the render mode (hardware, software, hybrid) at build time. Selection is not yet implemented.

Planned (not shipped)

These members are referenced in the spec but have no binding registered today. They are listed honestly as Planned.

nfc.readTag needs Android Activity dispatch or iOS CoreNFC entitlement.

biometrics.authenticate on Android needs a small Java shim for its callback.

bluetooth.isEnabled needs runtime-granted permission since API 31.

Additional media/capture bindings requiring Activity context or specific entitlements.

Native modules via DV.Modules: mount a Dartvel module inside a native app (see /docs/adopting and the native-app section below).

PREVIOUS Devices and desktop Native features, home widgets, kiosks, windows and trays
NEXT Media, 3D and XR Players, recorders, 3D scenes and spatial windows
GitHub
pub.dev
npm
Acknowledgements
Privacy
Terms

FSL-1.1-MIT licensed. Built with Dartvel.

Dartvel is made by

SigmaDev Digital

To the bottom