Tutorial · 10 min · beginner

Your first DartNative app

From dn create to a native list scrolling on your phone, in ten minutes.

What you'll build — running on device.

1. Create and run

dn create hello_native
cd hello_native
dn run

Plug in an iPhone or Android device (or use a simulator). dn run picks it up like flutter run does.

Notice the launch: dn create scaffolds a complete app, including a branded splash screen and app icons, wired natively (the iOS launch storyboard, Android assets, the fade into your first frame). It ships with the DartNative logo as a stand-in; make it yours with one command:

# drop your logo (1024×1024+) into assets/, then regenerate icon + splash:
dart run tool/generate_app_assets.dart --source=assets/your-logo.png --bg=#000000

That’s the whole branding step, and being a single deterministic command, it’s also something your coding assistant can run for you.

2. Make it yours

Open lib/main.dart:

import 'package:dartnative/dartnative.dart';
import 'dartnative_plugin_registrant.dart'; // generated by dn create

void main() {
  DartNativePluginRegistrant.registerAll(); // platform bindings — keep first
  runApp(const HomeScreen()); // the screen itself — no MaterialApp wrapper
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({super.key});
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Hello, native')),
      body: ListView(
        children: [
          for (var i = 0; i < 100; i++)
            ListTile(title: Text('Row $i')),
        ],
      ),
    );
  }
}

Everything around this file (the pubspec dependencies, the plugin registrant, the native iOS/Android projects, splash and icons) was wired by dn create; you only edit widgets. And one DartNative difference worth knowing from day one: there’s no MaterialApp; runApp takes your screen directly (the reconciler mounts it straight into the native view hierarchy). Multi-screen apps register routes with registerRoutes({...}) instead of a routes: map.

Scroll it. That momentum and rubber-band feel isn’t an imitation: it’s a real UITableView / RecyclerView under your Dart code.

3. Hot reload

Edit a string, save, and the running app updates. The reconciler diffs your widget tree and patches the native views in place.

Next: Porting a Flutter screen.