Dependencies
Dependencies come from dartpub.dev, the developer hub. It carries your account and subscription, the first-party plugins, and everything the community publishes. Every published version stays archived, so a dependency can never disappear from under a shipped app.
dependencies:
dartnative_supabase: ^0.1.0
dartnative_revenuecat: ^0.1.0
dartnative_notifications: ^0.1.0
Fetch them with dn pub get.
What’s on the hub
- First-party plugins: the native surface, maintained like a product: camera, video, audio, webview, maps, notifications, purchases, storage, on-device AI. Browse them on dartpub.dev.
- Community plugins: published with one command, discoverable in the same registry, versioned and archived on the same terms.
- Pure-Dart packages: no native code required. They ship as a Dart-only
tarball: no
xcodebuild, no macOS, nothing to compile.
That last point is worth knowing if you maintain a package: a pure-Dart package is as welcome on the hub as a native plugin, and publishing one puts it in front of every DartNative developer, with versions archived permanently.
Publishing your own
Once a plugin is registered, publishing is one command:
dn plugin publish
Two things come back to you for it:
- Production adoption discounts your framework subscription the more it’s used, scaled by how widely the package is actually used in shipped apps.
- The Contributor badge, the same title the core team carries.
If your package depends on another package from dartpub.dev, keep that line
plain in your pubspec.yaml. What dn publishes names the registry for it
(hosted: https://dartpub.dev), because pub reads a plain line inside a
published package as pub.dev’s.
See the publisher guide for registration and the full flow, or the licence page for how adoption is counted.
Also supported: pure-Dart packages from pub.dev
Pure-Dart packages from pub.dev are supported as well, and work unchanged: no fork, no patch, no wrapper, same version constraints.
dependencies:
# from dartpub.dev
dartnative_supabase: ^0.1.0
# from pub.dev: pure Dart, unchanged
dio: ^5.7.0
uuid: ^4.5.1
The rule is simple: if a package doesn’t import package:flutter, it just
works. In practice that’s most of what an app depends on: http, dio,
mqtt_client, uuid, crypto, intl, collection, equatable, get_it,
bloc (the core package; flutter_bloc is the Flutter-bound one),
solidart, logger and path all work as they are, along with the long tail
of parsers, formatters and utilities.
Where each line comes from
Every dependency is written the same way, as a plain line, whether it is on
dartpub.dev or on pub.dev. Before pub runs, dn looks up each new name in
your pubspec.yaml:
- On dartpub.dev only:
dntakes dartpub.dev’s package. - On pub.dev only:
dntakes pub.dev’s package. - On both:
dntakes dartpub.dev’s package, and tells you that pub.dev has one too.
dartpub.dev is the main registry, so when both have a package with the same
name, a plain line means dartpub.dev’s. DartNative’s own packages
(dartnative, dartnative_share, …) come with the SDK, as always.
This needs a dn from 30 October 2026 or later: run dn upgrade. An older
dn looks for a plain line on pub.dev only.
Choosing a registry: hosted:
To take a package from one registry in particular, name it in the line. This is pub’s own syntax, and a line that names its registry always wins:
dependencies:
# on both registries; this app wants pub.dev's
file_picker:
hosted: https://pub.dev
version: ^8.0.0
hosted: https://dartpub.dev does the same for dartpub.dev. From the
command line:
dn pub add "file_picker:{hosted: https://pub.dev}"
When a new name is on both registries, dn says which one it took, and how
to take the other:
dartnative: file_picker comes from dartpub.dev. pub.dev has another
package called file_picker; to use that one instead, run:
dn pub add "file_picker:{hosted: https://pub.dev}"
What keeps an app stable
- A resolved package stays where it came from.
pubspec.lockrecords the registry of every package, anddnkeeps it: throughdn pub get,dn pub upgrade, a fresh checkout and CI. If a package with the same name appears later on the other registry, an app that already has the name in its lock keeps its package. Only a new name is looked up. Commitpubspec.lock: without it, every name is new again. - Only your own lines are chosen. The dependencies of a package from pub.dev come from pub.dev, as its author meant, and so do the pub.dev packages DartNative itself needs.
The lock file is pub’s own. Each package records its registry, so every machine and CI get the same package (other fields left out):
packages:
local_auth_kit:
description:
name: local_auth_kit
url: "https://dartpub.dev"
source: hosted
http:
description:
name: http
url: "https://pub.dev"
source: hosted
When a package doesn’t work
The boundary is Flutter’s plugin mechanism. Flutter plugins reach native code
through platform channels, which the DartNative Zero engine doesn’t
support: it calls native code directly over FFI instead. A package built on
MethodChannel won’t compile, and neither will one that imports
package:flutter.
Two ways forward:
- Use the hub equivalent. Most Flutter packages you’d reach for already
have one:
path_provider,shared_preferences,permission_handler,share_plus,connectivity_plusandwebview_flutterall havedartnative_counterparts with the same API surface, so the change is usually the import line. - Port it and publish it. The plugin API is FFI rather than platform channels. The build a plugin tutorial walks through it end to end.