Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter pub run build_runner stuck

Tags:

flutter

dart

I'm having issue running the

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

The command does not go in error, but it's stuck on the first file:

WARNING] No actions completed for 15.0s, waiting on:
  - auto_route_generator:autoRouteGenerator on lib/ui/shared/ui_helpers.dart
  - auto_route_generator:autoRouteGenerator on lib/ui/views/settings/settings_datamodel.dart
  - auto_route_generator:autoRouteGenerator on lib/ui/views/settings/settings.dart
  - auto_route_generator:autoRouteGenerator on lib/ui/views/review_invitation/review_invitation_datamodel.dart
  - auto_route_generator:autoRouteGenerator on lib/ui/views/review_invitation/review_invitation.dart
  .. and 9 more

[INFO] 1m 17s elapsed, 1/15 actions completed.

The following is my pubspec:

dependencies:
  flutter:
    sdk: flutter

  # see below for explanation
  stacked_services:
  auto_route:
  stacked: ^1.7.6
  stacked_hooks: 0.1.1+3
  flutter_hooks:
  get_it:
  injectable:
  validators: ^2.0.0 

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.3

dev_dependencies:
  flutter_test:
    sdk: flutter

  build_runner:
  auto_route_generator:
  injectable_generator:

While this is the class for my router.dart

import 'package:auto_route/auto_route_annotations.dart';
import 'package:myapp/ui/views/StartupView.dart';

@MaterialAutoRouter(
  routes: <AutoRoute>[
    MaterialRoute(page: StartupView, initial: true),
  ],
)
class $Router {}

Any advices?

like image 437
xcsob Avatar asked Aug 29 '20 17:08

xcsob


3 Answers

method-1: if after upgrade flutter this issue happened try run:

flutter packages upgrade then flutter pub run build_runner build


method-2: this solves it for me:

1- flutter clean

2- delete all *.g.dart if exist

3- go on dev channel: flutter channel dev

4- upgrade: flutter upgrade --force

5- flutter pub get

6- try to build: flutter pub run build_runner build

7- back on stable or master channel: flutter channel stable (flutter channel master)

8- upgrade: flutter upgrade --force


like image 66
mshamsi502 Avatar answered Oct 20 '22 15:10

mshamsi502


Make sure that your project name doesn't contain '%20' characters. This causes any build methods, like flutter packages pub run build_runner build --delete-conflicting-outputs and flutter pub run build_runner clean to fail.

like image 41
Joe Muller Avatar answered Oct 20 '22 15:10

Joe Muller


A flutter pub upgrade solved my issue.

like image 21
xcsob Avatar answered Oct 20 '22 17:10

xcsob