dart-lang / build

A build system for Dart written in Dart
https://pub.dev/packages/build
BSD 3-Clause "New" or "Revised" License
791 stars 210 forks source link

unable to run flutter pub run build_runner build --delete-conflicting-outputs command #3540

Closed karthik14344 closed 1 year ago

karthik14344 commented 1 year ago

PROBLEM:i am unable to run this command ==> flutter pub run build_runner build --delete-conflicting-outputs

flutter pub run build_runner build --delete-conflicting-outputs
Deprecated. Use dart run instead. Building package executable... Failed to build build_runner:build_runner: ../../AppData/Local/Pub/Cache/hosted/pub.dev/build_runner_core-7.2.2/lib/src/logging/build_for_input_logger.dart:13:7: Error: The non-abstract class 'BuildForInputLogger' is missing implementations for these members:

class BuildForInputLogger implements Logger { ^^^^^^^^^^^^^^^^^^^ ../../AppData/Local/Pub/Cache/hosted/pub.dev/logging-1.2.0/lib/src/logger.dart:162:22: Context: 'Logger.onLevelChanged' is defined here. Stream<Level?> get onLevelChanged { ^^^^^^^^^^^^^^ ../../AppData/Local/Pub/Cache/hosted/pub.dev/build_runner-2.1.11/lib/src/build_script_generate/bootstrap.dart:76:40: Error: Method not found: 'NullThrownError'. final error = e[0] as Object? ?? NullThrownError();

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

HERE IS MY pubspec.yaml file

name: repo_viewer 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.12.0 <3.0.0'

dependencies: flutter: sdk: flutter oauth2: ^2.0.0 flutter_secure_storage: ^4.2.0 dartz: ^0.10.0-nullsafety.1 dio: ^4.0.0 flutter_hooks: ^0.18.6 hooks_riverpod: git: url: https://github.com/rrousselGit/river_pod.git ref: master path: packages/hooks_riverpod freezed_annotation: ^0.14.1 webview_flutter: ^2.0.4 auto_route: ^2.0.1 material_design_icons_flutter: ^5.0.5955-rc.1 json_annotation: ^4.0.1 sembast: ^3.0.2 path_provider: ^2.0.1 path: ^1.8.0 cached_network_image: ^3.0.0 shimmer: ^2.0.0 flash: ^1.5.2 material_floating_search_bar: ^0.3.4 url_launcher: ^6.0.3

dev_dependencies: flutter_test: sdk: flutter build_runner: ^2.0.1 freezed: ^0.14.1+3 auto_route_generator: ^2.0.1 json_serializable: ^4.1.1 lint: ^1.5.3

dependency_overrides: flutter_riverpod: git: url: https://github.com/rrousselGit/river_pod.git ref: master path: packages/flutter_riverpod riverpod: git: url: https://github.com/rrousselGit/river_pod.git ref: master path: packages/riverpod

flutter: uses-material-design: true

image_2023-07-05_002951522

jakemac53 commented 1 year ago

This was fixed in build_runner_core version 7.2.9, please upgrade your dependencies.

karthik14344 commented 1 year ago

This was fixed in build_runner_core version 7.2.9, please upgrade your dependencies.

when i changed build runner version into ^7.2.9 The output is [repo_viewer] flutter pub get Resolving dependencies... Because repo_viewer depends on build_runner ^7.2.9 which doesn't match any versions, version solving failed. exit code 1

jakemac53 commented 1 year ago

build_runner and build_runner_core are different packages - you should just be able to do a regular flutter pub upgrade to get the latest.

If that doesn't give you the latest, then you can try adding build_runner_core: ^7.2.9 to your deps, just to understand more why you can't get that version. But you should delete it afterwords as we don't intend users to have that dep (it has more frequent breaking changes).

karthik14344 commented 1 year ago

yeah now i am able to run the command. the other error i am facing is the routes error

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// import 'package:auto_route/auto_route.dart'; import 'package:repo_viewer/auth/presentation/sign_in_page.dart'; import 'package:repo_viewer/splash/presentation/splash_page.dart'; import 'package:repo_viewer/starred_repos/presentation/starred_repos_page.dart';

@MaterialAutoRouter(routes:[ MaterialRoute(page: SplashPage, initial: true), MaterialRoute(page: SignInPage), MaterialRoute(page: StarredReposPage), ]) class $AppRouter{} ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// image_2023-07-05_231029000

jakemac53 commented 1 year ago

It looks like you need to migrate to the latest version of package:auto_route, in 6.x they removed that class. They have a migration guide though.

You can try staying on an older version but that might not allow you to get a newer version of build_runner_core if the analyzer constraints aren't compatible.

jakemac53 commented 1 year ago

You could try explicitly pinning the logging package to version 1.1.1 in the meantime, if you are stuck on an older build_runner_core:

dev_dependencies:
  logging: 1.1.1
karthik14344 commented 1 year ago

It looks like you need to migrate to the latest version of package:auto_route, in 6.x they removed that class. They have a migration guide though.

You can try staying on an older version but that might not allow you to get a newer version of build_runner_core if the analyzer constraints aren't compatible.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

i am having the difficulty while re-writing that cord according new parameters could you plz help me that

import 'package:auto_route/auto_route.dart'; import 'package:repo_viewer/auth/presentation/sign_in_page.dart'; import 'package:repo_viewer/splash/presentation/splash_page.dart'; import 'package:repo_viewer/starred_repos/presentation/starred_repos_page.dart';

@MaterialAutoRouter(routes:[ MaterialRoute(Page: SplashPage, intial: true), MaterialRoute(Page: SignInPage), MaterialRoute(Page: StarredRepoPage), ], replaceInRouteName: 'Page,Route' ) class $AppRoute{}

jakemac53 commented 1 year ago

I am not familiar with the package, I would file an issue on the package itself asking for help.