Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build_runner does not generate mappings #7

Closed
xErik opened this issue Feb 28, 2022 · 3 comments
Closed

build_runner does not generate mappings #7

xErik opened this issue Feb 28, 2022 · 3 comments

Comments

@xErik
Copy link

xErik commented Feb 28, 2022

The build_runner does not generate the mapping file(s).
I created a test project with a PODO Bla, which the build_runner ignores.

(You mention to install dart_mappable, but give flutter pub add super_annotations. This is probably a leftover from your other project.)

I am new to flutter, the solution might be trivial.

Flutter 2.10.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 097d3313d8 (9 days ago) • 2022-02-18 19:33:08 -0600
Engine • revision a83ed0e5e3
Tools • Dart 2.16.1 • DevTools 2.9.2

Terminal

flutter pub run build_runner build
[INFO] Generating build script...
[INFO] Generating build script completed, took 686ms

[WARNING] Invalidated precompiled build script due to core package update
[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 12.6s

[SEVERE] Nothing can be built, yet a build was requested.
[INFO] Initializing inputs
[INFO] Reading cached asset graph...

[INFO] Checking for updates since last build...
[INFO] Checking for updates since last build completed, took 784ms

[INFO] Running build...
[INFO] Running build completed, took 7ms

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

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

pubspec.yaml

name: mapper_test
description: A new Flutter project.

environment:
  sdk: ">=2.16.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  cupertino_icons: ^1.0.2
  dart_mappable: ^0.9.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  flutter_lints: ^1.0.0
  build_runner: ^2.1.7

flutter:

  uses-material-design: true

targets:
  $default:
    builders:
      dart_mappable:
        generate_for:
          - lib/main.dart
        options: # tried with and without class option
        - include: [Bla] 

main.dart

import 'package:flutter/material.dart';
import 'package:dart_mappable/dart_mappable.dart';

void main() {
  runApp(const MyApp());
}

// auto-generated stuff only

@MappableClass()
class Bla {
  int count;
  Bla(this.count);
}

@schultek
Copy link
Owner

(You mention to install dart_mappable, but give flutter pub add super_annotations. This is probably a leftover from your other project.)

Oh yes, this is wrong.

targets:
  $default:
    builders:
      dart_mappable:
        generate_for:
          - lib/main.dart
        options: # tried with and without class option
        - include: [Bla] 

This should be in the build.yaml file, not the pubspec.yaml.

@xErik
Copy link
Author

xErik commented Feb 28, 2022

Silly mistake, sorry.
Still struggling a bit with the whole flutter ecosystem.
Thank you!

@xErik xErik closed this as completed Feb 28, 2022
@schultek
Copy link
Owner

Happy to help, if you have any other questions let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants