💻 آخرین فرصت یادگیری برنامه‌نویسی با آفر ویژه قبل از افزایش قیمت در ۵ آذر ماه (🎁 به همراه یک هدیه ارزشمند )
۰ ثانیه
۰ دقیقه
۰ ساعت
۲ مهدی طاهری
ارور در ایجاد فایل g.dart
محسن موحد حل شده توسط محسن موحد

سلام من با این ارور مواجه شدم و هر کاری کردم درست نشد

 

Deprecated. Use `dart run` instead.
Building package executable... (8.4s)
Built build_runner:build_runner.
[INFO] Generating build script completed, took 366ms
[INFO] Reading cached asset graph completed, took 83ms
[INFO] Checking for updates since last build completed, took 610ms
[WARNING] hive_generator on lib/main.dart:
Your current `analyzer` version may not fully support your current SDK version.
Analyzer language version: 2.19.0
SDK language version: 3.1.0
Please update to the latest `analyzer` version (6.3.0) by running
`flutter packages upgrade`.
If you are not getting the latest version by running the above command, you
can try adding a constraint like the following to your pubspec to start
diagnosing why you can't get the latest version:
dev_dependencies:
  analyzer: ^6.3.0
[WARNING] source_gen:combining_builder on lib/data/Product.dart:
Product.g.dart must be included as a part directive in the input library with:
    part 'Product.g.dart';
[INFO] Running build completed, took 8.1s
[INFO] Caching finalized dependency graph completed, took 42ms
[SEVERE] hive_generator on lib/ui/receipt/bloc/payment_receipt_bloc.dart (cached):
This builder requires Dart inputs without syntax errors.
However, package:shop/ui/receipt/bloc/payment_receipt_event.dart (or an existing part) contains the following errors.
payment_receipt_event.dart:3:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
payment_receipt_event.dart:3:1: Expected to find ';'.
Try fixing the errors and re-running the build.
[SEVERE] hive_generator on lib/ui/home/bloc/home_bloc.dart (cached):
This builder requires Dart inputs without syntax errors.
However, package:shop/ui/home/bloc/home_event.dart (or an existing part) contains the following errors.
home_event.dart:3:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
home_event.dart:3:1: Expected to find ';'.
Try fixing the errors and re-running the build.
[SEVERE] hive_generator on lib/ui/cart/bloc/cart_bloc.dart (cached):
This builder requires Dart inputs without syntax errors.
However, package:shop/ui/cart/bloc/cart_event.dart (or an existing part) contains the following errors.
cart_event.dart:3:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
cart_event.dart:3:1: Expected to find ';'.
Try fixing the errors and re-running the build.
[SEVERE] hive_generator on lib/ui/auth/bloc/auth_bloc.dart (cached):
This builder requires Dart inputs without syntax errors.
However, package:shop/ui/auth/bloc/auth_event.dart (or an existing part) contains the following errors.
auth_event.dart:3:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
auth_event.dart:3:1: Expected to find ';'.
Try fixing the errors and re-running the build.
[SEVERE] hive_generator on lib/ui/list/bloc/product_list_bloc.dart (cached):
This builder requires Dart inputs without syntax errors.
However, package:shop/ui/list/bloc/product_list_event.dart (or an existing part) contains the following errors.
product_list_event.dart:3:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
product_list_event.dart:3:1: Expected to find ';'.
Try fixing the errors and re-running the build.
[SEVERE] hive_generator on lib/ui/Product/bloc/product_bloc.dart (cached):
This builder requires Dart inputs without syntax errors.
However, package:shop/ui/Product/bloc/product_event.dart (or an existing part) contains the following errors.
product_event.dart:3:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
product_event.dart:3:1: Expected to find ';'.
Try fixing the errors and re-running the build.
[SEVERE] hive_generator on lib/ui/shipping/bloc/shipping_bloc.dart (cached):
This builder requires Dart inputs without syntax errors.
However, package:shop/ui/shipping/bloc/shipping_event.dart (or an existing part) contains the following errors.
shipping_event.dart:3:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
shipping_event.dart:3:1: Expected to find ';'.
Try fixing the errors and re-running the build.
[SEVERE] hive_generator on lib/ui/Product/comment/bloc/comment_list_bloc.dart (cached):
This builder requires Dart inputs without syntax errors.
However, package:shop/ui/Product/comment/bloc/comment_list_event.dart (or an existing part) contains the following errors.
comment_list_event.dart:3:1: Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
comment_list_event.dart:3:1: Expected to find ';'.
Try fixing the errors and re-running the build.
[SEVERE] Failed after 8.1s

سلام،

به نظر می‌رسد مشکل از خطاهای سینتکس در فایل‌های event در بلوک‌های مختلف UI است.

خطاهای زیر گزارش شده است:


Variables must be declared using the keywords 'const', 'final', 'var' or a type name.
Expected to find ';'.

یعنی متغیرها باید با کلمات کلیدی const، final، var یا نام نوع تعریف شوند و در انتهای تعریف متغیر باید یک ; باشد.

برای فیکس کردن:

1. فایل‌های event مربوط به هر بلوک را باز کنید (مثلاً payment_receipt_event.dart)

2. متغیرها را درست تعریف کنید.

3. پس از اینکه خطاها اصلاح شدند، مجدداً فرآیند بیلد را انجام دهید.

 

بهترین پاسخ
محسن موحد ۰۳ آذر ۱۴۰۲، ۲۳:۰۸

دم شما گرم، ان شالله همه کدات بدون خطا اجرا شن 

مهدی طاهری ۰۴ آذر ۱۴۰۲، ۰۹:۵۶