I followed the basic example, but when I run the command flutter pub run realm generate, it can’t run forever (about 30 minutes). Please help me. Thank you.
Ran on: Dell | Flutter 3.7.12 | Dart 2.19.6 | realm 1.0.3
What I’ve done:
- Restart the terminal
- Restart the computer
Repro Steps
- Add the code snippet below (app.dart) to a flutter project
- Run
flutter pub run realm generate
Code Snippet
/lib/app.dart
import 'package:realm/realm.dart'; // import realm package
part 'app.g.dart'; // declare a part file.
@RealmModel() // define a data model class named `_Car`.
class _Car {
late String make;
late String model;
int? kilometers = 500;
}

Adding your model to a freshly created flutter project in the file lib/app.dart
and running generate
❯ time dart run realm generate
Building package executable...
Built realm:realm.
[INFO] Generating build script...
[INFO] Generating build script completed, took 149ms
[INFO] Initializing inputs
[INFO] Reading cached asset graph...
[INFO] Reading cached asset graph completed, took 30ms
[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 476ms
[INFO] Running build...
[INFO] 1.5s elapsed, 0/1 actions completed.
[INFO] Running build completed, took 1.6s
[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 18ms
[INFO] Succeeded after 1.6s with 1 outputs (1 actions)
________________________________________________________
Executed in 3.73 secs fish external
usr time 4.45 secs 0.09 millis 4.45 secs
sys time 0.82 secs 1.64 millis 0.82 secs
So a little under 4s on my M1 Max. It shouldn’t hang like you describe.
Could you share what output you do see, as well as how your pubspec.yam
l looks?
Also, what is the output of flutter doctor -v
?
name: flutter_application_4
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.19.6 <3.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
realm: ^1.0.3
build_runner: ^2.3.3
dev_dependencies:
flutter_test:
sdk: flutter
realm_generator: ^1.0.3
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
When I run the command there is no output and it just hangs, even though I have created a brand new project
On Mac I don’t hang with that combination, but I do get a failure on exit.
❯ flutter pub run realm generate
pub finished with exit code 255
I’ll need to investigate further.
I look forward to hearing from you
This is a bit puzzling. Can I ask you to update to latest stable (3.10.1) and remove the realm_generator
dev dependency (Realm will pull it in as normal dependency).
Thank you for your help. The problem has been resolved. The problem was caused by my network. I solved using VPN 1.1.1.1 and the command flutter pub run realm generate worked.