flutter_gen icon indicating copy to clipboard operation
flutter_gen copied to clipboard

[BUG]: The class 'FileSystemEvent' can't be extended

Open subzero911 opened this issue 1 year ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Version

3.1.5

Command type

build_runner (Default)

What happened?

Something happened, and now I always get an error, trying to build assets.

Relevant a pubspec.yaml.

name: goldy
description: Children task tracker.

publish_to: 'none'

version: 1.0.0+10

environment:
  sdk: '>=3.0.0 <4.0.0'

dependencies:
  after_layout: ^1.2.0
  avatar_stack: ^1.1.2
  cached_network_image: ^3.2.3
  collection: ^1.17.2
  cupertino_icons: ^1.0.2
  currency_text_input_formatter: ^2.1.8
  dynamic_height_grid_view: ^0.0.3
  email_validator: ^2.1.17
  flutter:
    sdk: flutter
  flutter_animate: ^4.2.0+1
  flutter_flavor: ^3.1.3
  flutter_inappwebview: ^5.7.2+3
  flutter_localizations:
    sdk: flutter
  flutter_mobx: ^2.1.1
  flutter_multi_formatter: ^2.10.2
  flutter_secure_storage: ^8.0.0
  flutter_svg: ^2.0.7
  flutter_top_blocked_bouncing_scroll_physics: ^1.0.0
  fluttertoast: ^8.2.2
  fresh_graphql: ^0.5.2
  get_it: ^7.6.0
  go_router: ^7.1.1
  gql_http_link: ^1.0.1
  graphql: ^5.2.0-beta.4
  graphql_codegen: ^0.13.4
  graphql_flutter: ^5.1.2
  hive: ^2.2.3
  hive_flutter: ^1.1.0
  infinite_listview: ^1.1.0 # двунаправленный список; используется в календаре
  intl: ^0.18.0
  json_annotation: ^4.8.1
  just_the_tooltip: ^0.0.12
  local_auth: ^2.1.5
  local_auth_android: ^1.0.19
  local_auth_ios: ^1.0.13
  logger: ^1.2.2
  mobx: ^2.2.1
  mts_granat:
    path: packages/mts_granat
  network_info_plus: ^4.1.0
  page_view_dot_indicator: ^2.3.0
  pin_code_fields:
    git:
      url: https://github.com/adar2378/pin_code_fields.git
      ref: master
  quiver: ^3.2.1
  #  sdk_sso_flutter:
  #    git:
  #      url: https://gitlab.services.mts.ru/goldy/SDKSSO.git
  #      ref: master
  share_plus: ^7.2.1
  shared_preferences: ^2.1.2
  shimmer: ^3.0.0
  slang: ^3.11.1
  slang_flutter: ^3.11.0
  time: ^2.1.3
  url_launcher: ^6.1.14
  very_good_infinite_list: ^0.7.1

dev_dependencies:
  build_runner: ^2.4.6
  flutter_gen_runner: ^5.3.2
  flutter_lints: ^2.0.2
  flutter_test:
    sdk: flutter
  json_serializable: ^6.7.1
  json_serializable_mobx: ^0.10.3
  melos: ^3.2.0
  mobx_codegen: ^2.3.0

dependency_overrides:
  collection: ^1.17.2 # flutter_test опирается на 1.17.1

flutter_gen:
  output: lib/gen/ # Optional (default: lib/gen/)
  line_length: 80 # Optional (default: 80)

  # Optional
  integrations:
    flutter_svg: true
    flare_flutter: false
    rive: false
    lottie: false
  # colors:
  #   inputs:
  #     - assets/color/colors.xml
flutter:

  uses-material-design: true
  assets:
    - assets/images/
    - assets/images/wallet/
    - assets/images/wallet/card_logos/
    - assets/images/wallet/coins_exchange_statuses/
    - assets/images/mascot/
    - assets/icons/
    - assets/icons/new_task/
    - assets/icons/task_details/
    - assets/icons/nav_bar/
    - assets/icons/rewards/
    - assets/icons/wallet/
    - assets/icons/task_sample/

Relevant log output

svmolchan1@0000NBB0TX4DJ20 goldy % fluttergen     
Can't load Kernel binary: Invalid kernel binary format version.
Building package executable... 
Failed to build flutter_gen:flutter_gen_command:
../../../.pub-cache/hosted/pub.dev/watcher-1.0.2/lib/src/constructable_file_system_event.dart:7:57: Error: The class 'FileSystemEvent' can't be extended, implemented, or mixed in outside of its library because it's a sealed class.
abstract class _ConstructableFileSystemEvent implements FileSystemEvent {
                                                        ^

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

subzero911 avatar Nov 28 '23 12:11 subzero911

Update: it works if using build_runner though

image

But when I directly call fluttergen it fails

subzero911 avatar Dec 01 '23 09:12 subzero911

is there any update for this issues?

anggit97 avatar Feb 11 '24 09:02 anggit97

This is likely to be an issue related to some conflicts between the watcher package and the Dart SDK. I cannot reproduce by running dart pub global activate flutter_gen.

$ dart pub global activate flutter_gen                                                                                                                                                  
+ _fe_analyzer_shared 67.0.0                                                                                                                                                            
+ analyzer 6.4.1                                                                                                                                                                        
+ args 2.4.2
+ async 2.11.0
+ characters 1.3.0
+ clock 1.1.1
+ collection 1.18.0
+ color 3.0.0
+ convert 3.1.1
+ crypto 3.0.3
+ dart_style 2.3.5
+ dartx 1.2.0
+ file 7.0.0
+ flutter_gen 5.4.0
+ flutter_gen_core 5.4.0
+ glob 2.1.2
+ json_annotation 4.8.1
+ meta 1.12.0
+ mime 1.0.5
+ package_config 2.1.0
+ path 1.9.0
+ petitparser 6.0.2
+ pub_semver 2.1.4
+ source_span 1.10.0
+ string_scanner 1.2.0
+ term_glyph 1.2.1
+ time 2.1.4
+ typed_data 1.3.2
+ watcher 1.1.0
+ xml 6.5.0
+ yaml 3.1.2
Building package executables... (5.0s)
Built flutter_gen:flutter_gen_command.
Installed executable fluttergen.
Activated flutter_gen 5.4.0.

Please submit more info if the issue persists.

AlexV525 avatar Feb 29 '24 05:02 AlexV525

@AlexV525 how can I resolve this conflict? I don't use watcher, probably, some plugins indirectly use it. Please don't close the issue, it still persists.

subzero911 avatar Feb 29 '24 09:02 subzero911

You can see from my logs that when you're trying to activate fluttergen, it installs watcher, so there is a good chance that it resolves the watcher version depends on your Dart SDK. It's not a project-related problem so the only thing you can do is to upgrade can give another try.

AlexV525 avatar Feb 29 '24 12:02 AlexV525

image

I tried to override watcher, and it didn't help.

subzero911 avatar Mar 18 '24 15:03 subzero911

Please try to upgrade the SDK as I previously stated:

It's not a project-related problem so the only thing you can do is to upgrade can give another try.

AlexV525 avatar Mar 18 '24 15:03 AlexV525

I understand now. It was installed with flutter pub global activate, and the package version actually was outdated. After I deactivated it and re-installed with Homebrew, the problem was solved. image

subzero911 avatar Mar 18 '24 15:03 subzero911

The package will also be upgraded if you run flutter/dart pub global activate, Homebrew is not a requirement.

AlexV525 avatar Mar 18 '24 15:03 AlexV525