Mobx.dart: no outputs on build_runner build

Created on 5 Jan 2020  Â·  22Comments  Â·  Source: mobxjs/mobx.dart

Hello, I can't seem to get build_runner to generate anything.

Running

flutter packages pub run build_runner clean && flutter packages pub run build_runner build --delete-conflicting-outputs

outputs the following:

[INFO] Generating build script...
[INFO] Generating build script completed, took 454ms

[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 18.6s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 1.0s

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] 1.1s elapsed, 0/16 actions completed.
[INFO] 2.1s elapsed, 0/16 actions completed.
[INFO] 3.3s elapsed, 0/16 actions completed.
[INFO] 4.4s elapsed, 0/16 actions completed.
[INFO] 5.5s elapsed, 0/16 actions completed.
[INFO] 6.5s elapsed, 0/16 actions completed.
[INFO] 7.5s elapsed, 0/16 actions completed.
[INFO] 8.7s elapsed, 0/16 actions completed.
[INFO] 19.6s elapsed, 0/16 actions completed.
[WARNING] No actions completed for 19.6s, waiting on:
  - json_serializable:json_serializable on test/widget_test.dart
  - json_serializable:json_serializable on lib/view_models/event_selected_view_model.dart
  - json_serializable:json_serializable on lib/repositories/UserRepository.dart
  - json_serializable:json_serializable on lib/models/Organization.dart
  - json_serializable:json_serializable on lib/models/User.dart
  .. and 11 more

[INFO] 21.0s elapsed, 2/18 actions completed.
[INFO] 22.0s elapsed, 12/27 actions completed.
[INFO] 23.4s elapsed, 18/33 actions completed.
[INFO] 24.5s elapsed, 60/76 actions completed.
[WARNING] mobx_codegen:mobx_generator on lib/mobx/Authentication.dart:
Missing "part 'Authentication.g.dart';".
[INFO] 26.2s elapsed, 134/141 actions completed.
[INFO] Running build completed, took 26.4s

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 110ms

[INFO] Succeeded after 26.5s with 14 outputs (148 actions)

The only outputs are from json_serializable.

My store file looks like this:

import 'package:mobx/mobx.dart';
part "authentication.g.dart";

class Authentication = AuthenticationBase with _$Authentication;

abstract class AuthenticationBase with Store {

}

I saw

Missing "part 'Authentication.g.dart';".

So I removed that line + the class line:

import 'package:mobx/mobx.dart';

abstract class AuthenticationBase with Store {

}

I then get this:

[INFO] Generating build script...
[INFO] Generating build script completed, took 586ms

[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 22.5s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 1.7s

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 2ms

[INFO] Running build...
[INFO] 1.1s elapsed, 0/16 actions completed.
[INFO] 2.2s elapsed, 0/16 actions completed.
[INFO] 3.2s elapsed, 0/16 actions completed.
[INFO] 4.3s elapsed, 0/16 actions completed.
[INFO] 5.5s elapsed, 0/16 actions completed.
[INFO] 6.6s elapsed, 0/16 actions completed.
[INFO] 7.6s elapsed, 0/16 actions completed.
[INFO] 8.9s elapsed, 0/16 actions completed.
[INFO] 9.9s elapsed, 0/16 actions completed.
[INFO] 20.3s elapsed, 1/16 actions completed.
[INFO] 21.4s elapsed, 1/17 actions completed.
[INFO] 23.3s elapsed, 17/29 actions completed.
[INFO] 24.7s elapsed, 48/63 actions completed.
[INFO] 25.7s elapsed, 116/123 actions completed.
[INFO] Running build completed, took 26.1s

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 106ms

[INFO] Succeeded after 26.2s with 14 outputs (148 actions)

Still without generated files.

Pubspec.yaml:

name: buggerino_flutter
description: A new Flutter project.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.2.2 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2
  flutter_keychain: ^1.0.0
  http: ^0.12.0+2
  bloc: ^2.0.0
  flutter_bloc: ^2.0.0
  equatable: ^0.6.1
  json_annotation: ^3.0.0
  mobx: ^0.4.0+1
  flutter_mobx: ^0.3.6

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^1.7.2
  json_serializable: ^3.2.0
  mobx_codegen: ^0.4.0+1


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  # assets:
  #  - images/a_dot_burr.jpeg
  #  - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  # fonts:
  #   - family: Schyler
  #     fonts:
  #       - asset: fonts/Schyler-Regular.ttf
  #       - asset: fonts/Schyler-Italic.ttf
  #         style: italic
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

Most helpful comment

I had this problem today and put these versions and it worked, in case anyone needs

Flutter (Channel stable, 1.20.1)
mobx: ^1.2.1+2
build_runner: 1.10.1
mobx_codegen: ^1.1.0+1

and then the commands

flutter clean
flutter pub get
flutter packages upgrade

flutter pub run build_runner watch --delete-conflicting-outputs

[INFO] Succeeded after 360ms with 0 outputs (5 actions)

All 22 comments

Rename your file to authenticator.dart (all lowercase), and it should start working.

MobX requires that the names match exactly, so authenticator.dart and authenticator.g.dart. Plus, Dart style recommends lowercase file names.

Closing it for now.

Renaming my file to authenticator.dart or authentication.dart also did not work =( @shyndman

[INFO] Generating build script...
[INFO] Generating build script completed, took 420ms

[INFO] Creating build script snapshot......
[INFO] Creating build script snapshot... completed, took 21.6s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 1.3s

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Checking for unexpected pre-existing outputs. completed, took 1ms

[INFO] Running build...
[INFO] 1.0s elapsed, 0/16 actions completed.
[INFO] 2.1s elapsed, 0/16 actions completed.
[INFO] 3.1s elapsed, 0/16 actions completed.
[INFO] 4.6s elapsed, 0/16 actions completed.
[INFO] 5.6s elapsed, 0/16 actions completed.
[INFO] 6.8s elapsed, 0/16 actions completed.
[INFO] 8.0s elapsed, 0/16 actions completed.
[INFO] 9.0s elapsed, 0/16 actions completed.
[INFO] 10.1s elapsed, 0/16 actions completed.
[INFO] 11.1s elapsed, 0/16 actions completed.
[INFO] 12.2s elapsed, 0/16 actions completed.
[INFO] 13.3s elapsed, 0/16 actions completed.
[INFO] 14.3s elapsed, 0/16 actions completed.
[INFO] 24.6s elapsed, 0/16 actions completed.
[WARNING] No actions completed for 24.6s, waiting on:
  - json_serializable:json_serializable on test/widget_test.dart
  - json_serializable:json_serializable on lib/view_models/event_selected_view_model.dart
  - json_serializable:json_serializable on lib/repositories/UserRepository.dart
  - json_serializable:json_serializable on lib/models/Organization.dart
  - json_serializable:json_serializable on lib/models/User.dart
  .. and 11 more

[INFO] 26.2s elapsed, 1/17 actions completed.
[INFO] 28.8s elapsed, 17/29 actions completed.
[INFO] 29.9s elapsed, 35/47 actions completed.
[INFO] 30.9s elapsed, 61/73 actions completed.
[INFO] 32.0s elapsed, 134/141 actions completed.
[INFO] Running build completed, took 32.2s

[INFO] Caching finalized dependency graph...
[INFO] Caching finalized dependency graph completed, took 121ms

[INFO] Succeeded after 32.4s with 14 outputs (148 actions)

Nevermind, it somehow started working. Thanks for the help!

How? What did you do?
I am having similar experience :cry:

I'm having the exact same issue and nothing seems to be working

Has anyone managed to solve the problem? Has any explanation

I think I followed the instructions provided by @shyndman, ran flutter clean and it magically started working for me.

I think I followed the instructions provided by @shyndman, ran flutter clean and it magically started working for me.

Same problem here:

  • flutter clean

  • flutter pub get

  • flutter pub run build_runner build --delete-conflicting-outputs --verbose

... and, it started working again!

also
flutter packages upgrade

Unfortunately I'm still not able to fix this issue on my Mac. Previously, last time when I was working with Mobx, about a month ago, it was working fine. Today I return to Mobx and I decided to upgrade my Flutter SDK to newest version and since then Mobx codegen stops working.

I tried commands:

  • flutter clean
  • flutter pub get
  • flutter pub run build_runner build --delete-conflicting-outputs --verbose

and after that cmd printing me this without end:

[INFO] Heartbeat:11m 35s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 36s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 37s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 38s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 39s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 40s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 42s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 43s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 44s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 45s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 46s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 47s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 48s elapsed, 1/4 actions completed.
[INFO] Heartbeat:11m 49s elapsed, 1/4 actions completed.
[WARNING] Heartbeat:
No actions completed for 15.1s, waiting on:
  - mobx_codegen:mobx_generator on lib/states/homepagestore.dart
  - mobx_codegen:mobx_generator on lib/pages/homepage.dart
  - mobx_codegen:mobx_generator on test/widget_test.dart

This is how my homepagestore.dart looks like:

import 'package:mobx/mobx.dart';

part 'homepagestore.g.dart';

class HomePageStore extends _HomePageStoreStore with _$HomePageStore {}

abstract class _HomePageStoreStore with Store {
}

this is my pubspec.yaml:

name: flutter_xiaomi_ble_mobx_app
description: A new Flutter application.

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^0.1.3
  mobx: ^1.2.1+2
  flutter_mobx: any

dev_dependencies:
  flutter_test:
    sdk: flutter

  build_runner:
  mobx_codegen: ^1.1.0+1

flutter:

  uses-material-design: true

flutter doctor:

[✓] Flutter (Channel stable, 1.20.1, on Mac OS X 10.15.6 19G73, locale en-PL)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.47.3)
[✓] Connected device (1 available)

• No issues found!

Same problem here also

I'm facing same issue. did anyone find any solution?

Hi, if the above fixes don't work for you, please create a new issue. It is most likely unrelated to the problems described in this one and by going through the new issue flow you can add more information, like your version number etc etc.

@jordyvandomselaar So the solution work for me is I switch back to flutter 1.17.0 from 1.20.

@sandeep9607 Then please create a new issue where you use 1.20 so the package author can look into the issues.

I had this problem today and put these versions and it worked, in case anyone needs

Flutter (Channel stable, 1.20.1)
mobx: ^1.2.1+2
build_runner: 1.10.1
mobx_codegen: ^1.1.0+1

and then the commands

flutter clean
flutter pub get
flutter packages upgrade

flutter pub run build_runner watch --delete-conflicting-outputs

[INFO] Succeeded after 360ms with 0 outputs (5 actions)

I had this problem today and put these versions and it worked, in case anyone needs

Flutter (Channel stable, 1.20.1)
mobx: ^1.2.1+2
build_runner: 1.10.1
mobx_codegen: ^1.1.0+1

and then the commands

flutter clean
flutter pub get
flutter packages upgrade

flutter pub run build_runner watch --delete-conflicting-outputs

[INFO] Succeeded after 360ms with 0 outputs (5 actions)

Work for me, tkss @chrystoffer

I had this problem today and put these versions and it worked, in case anyone needs

Flutter (Channel stable, 1.20.1)
mobx: ^1.2.1+2
build_runner: 1.10.1
mobx_codegen: ^1.1.0+1

and then the commands

flutter clean
flutter pub get
flutter packages upgrade

flutter pub run build_runner watch --delete-conflicting-outputs

[INFO] Succeeded after 360ms with 0 outputs (5 actions)

Work for me, tkss @chrystoffer

Wok form me too @chrystoffer

[INFO] Succeeded after 26.8s with 2 outputs (173 actions)

I switched to stable flutter branch.

This work for me

flutter packages upgrade
flutter pub run build_runner build --delete-conflicting-outputs --verbose

Was this page helpful?
0 / 5 - 0 ratings