objectbox-dart icon indicating copy to clipboard operation
objectbox-dart copied to clipboard

Freezed entities don't work well with objectbox_generator

Open atarana opened this issue 3 years ago • 11 comments

ObjectBox Generator doesn't generate objectbox-model.json and objectbox.g.dart with freezed entities.

As a workaround I found that using flutter pub run build_runner watch --delete-conflicting-outputs and changing just one of the entity's @Id(assignable: ) from true to false and vice-versa does the trick sometimes.

Basic info (please complete the following information):

  • ObjectBox version: 1.5.0
  • Flutter/Dart SDK: Flutter 3.0.0 Stable - Dart 2.17.0
  • Null-safety enabled: yes
  • Reproducibility: always
  • OS: macOs BigSur
  • Device/Emulator: Galaxy A50

Additionally, you can choose to provide more details, e.g. the output of:

  • pub deps --no-dev:
Dart SDK 2.17.0
Flutter SDK 3.0.0
testProj 0.8.2+43
|-- animated_check 1.0.5
|   '-- flutter...
|-- animated_text_kit 4.2.1
|   |-- characters 1.2.0
|   '-- flutter...
|-- another_flushbar 1.10.28
|   '-- flutter...
|-- auto_route 4.0.1
|   |-- collection 1.16.0
|   |-- flutter...
|   |-- meta 1.7.0
|   |-- path 1.8.1
|   '-- universal_html 2.0.8
|       |-- async...
|       |-- charcode...
|       |-- collection...
|       |-- csslib 0.17.1
|       |   '-- source_span...
|       |-- html 0.15.0
|       |   |-- csslib...
|       |   '-- source_span...
|       |-- meta...
|       |-- source_span 1.8.2
|       |   |-- collection...
|       |   |-- path...
|       |   '-- term_glyph 1.2.0
|       |-- typed_data...
|       '-- universal_io 2.0.4
|           |-- collection...
|           |-- crypto...
|           |-- meta...
|           '-- typed_data...
|-- cached_network_image 3.2.0
|   |-- cached_network_image_platform_interface 1.0.0
|   |   |-- flutter...
|   |   '-- flutter_cache_manager...
|   |-- cached_network_image_web 1.0.1
|   |   |-- cached_network_image_platform_interface...
|   |   |-- flutter...
|   |   '-- flutter_cache_manager...
|   |-- flutter...
|   |-- flutter_cache_manager 3.3.0
|   |   |-- clock...
|   |   |-- collection...
|   |   |-- file 6.1.2
|   |   |   |-- meta...
|   |   |   '-- path...
|   |   |-- flutter...
|   |   |-- http 0.13.4
|   |   |   |-- async...
|   |   |   |-- http_parser...
|   |   |   |-- meta...
|   |   |   '-- path...
|   |   |-- path...
|   |   |-- path_provider...
|   |   |-- pedantic...
|   |   |-- rxdart...
|   |   |-- sqflite 2.0.2
|   |   |   |-- flutter...
|   |   |   |-- path...
|   |   |   '-- sqflite_common 2.2.0
|   |   |       |-- meta...
|   |   |       |-- path...
|   |   |       '-- synchronized 3.0.0
|   |   '-- uuid...
|   '-- octo_image 1.0.1
|       |-- flutter...
|       '-- flutter_blurhash 0.6.0
|           |-- flutter...
|           |-- meta...
|           '-- pedantic...
|-- camera 0.9.4+11
|   |-- camera_platform_interface 2.1.5
|   |   |-- cross_file 0.3.2
|   |   |   |-- flutter...
|   |   |   |-- js...
|   |   |   '-- meta...
|   |   |-- flutter...
|   |   |-- plugin_platform_interface 2.1.2
|   |   |   '-- meta...
|   |   '-- stream_transform 2.0.0
|   |-- camera_web 0.2.1+1
|   |   |-- camera_platform_interface...
|   |   |-- flutter...
|   |   |-- flutter_web_plugins 0.0.0
|   |   |   |-- characters...
|   |   |   |-- collection...
|   |   |   |-- flutter...
|   |   |   |-- js...
|   |   |   |-- material_color_utilities...
|   |   |   |-- meta...
|   |   |   '-- vector_math...
|   |   '-- stream_transform...
|   |-- flutter...
|   |-- flutter_plugin_android_lifecycle 2.0.5
|   |   '-- flutter...
|   |-- pedantic 1.11.1
|   '-- quiver 3.0.1+1
|       '-- matcher 0.12.11
|           '-- stack_trace...
|-- carousel_slider 4.0.0
|   '-- flutter...
|-- charcode 1.3.1
|-- connectivity_plus 2.2.1
|   |-- connectivity_plus_linux 1.3.0
|   |   |-- connectivity_plus_platform_interface...
|   |   |-- flutter...
|   |   |-- meta...
|   |   '-- nm 0.5.0
|   |       '-- dbus 0.7.2
|   |           |-- args...
|   |           |-- ffi...
|   |           |-- meta...
|   |           '-- xml...
|   |-- connectivity_plus_macos 1.2.1
|   |   |-- connectivity_plus_platform_interface...
|   |   '-- flutter...
|   |-- connectivity_plus_platform_interface 1.2.0
|   |   |-- flutter...
|   |   |-- meta...
|   |   '-- plugin_platform_interface...
|   |-- connectivity_plus_web 1.2.0
|   |   |-- connectivity_plus_platform_interface...
|   |   |-- flutter...
|   |   '-- flutter_web_plugins...
|   |-- connectivity_plus_windows 1.2.0
|   |   |-- connectivity_plus_platform_interface...
|   |   '-- flutter...
|   '-- flutter...
|-- crypto 3.0.1
|   |-- collection...
|   '-- typed_data 1.3.0
|       '-- collection...
|-- cupertino_icons 1.0.4
|-- dart_jsonwebtoken 2.4.1
|   |-- collection...
|   |-- convert 3.0.1
|   |   '-- typed_data...
|   |-- crypto...
|   '-- pointycastle 3.5.1
|       |-- collection...
|       |-- convert...
|       '-- js 0.6.4
|-- dartz 0.10.1
|-- dio 4.0.6
|   |-- http_parser 4.0.0
|   |   |-- charcode...
|   |   |-- collection...
|   |   |-- source_span...
|   |   |-- string_scanner...
|   |   '-- typed_data...
|   '-- path...
|-- dio_smart_retry 1.2.0
|   '-- dio...
|-- easy_localization 3.0.1-dev
|   |-- args 2.3.0
|   |-- easy_logger 0.0.2
|   |   '-- flutter...
|   |-- flutter...
|   |-- flutter_localizations 0.0.0
|   |   |-- characters...
|   |   |-- clock...
|   |   |-- collection...
|   |   |-- flutter...
|   |   |-- intl...
|   |   |-- material_color_utilities...
|   |   |-- meta...
|   |   |-- path...
|   |   '-- vector_math...
|   |-- intl...
|   |-- path...
|   '-- shared_preferences...
|-- encrypt 5.0.1
|   |-- args...
|   |-- asn1lib 1.1.0
|   |-- clock 1.1.0
|   |-- collection...
|   |-- crypto...
|   '-- pointycastle...
|-- english_words 4.0.0
|   '-- string_scanner 1.1.0
|       |-- charcode...
|       '-- source_span...
|-- equatable 2.0.3
|   |-- collection...
|   '-- meta...
|-- flutter 0.0.0
|   |-- characters...
|   |-- collection...
|   |-- material_color_utilities 0.1.4
|   |-- meta...
|   |-- sky_engine 0.0.99
|   '-- vector_math 2.1.2
|-- flutter_bloc 8.0.1
|   |-- bloc 8.0.2
|   |   '-- meta...
|   |-- flutter...
|   '-- provider...
|-- flutter_image_compress 1.1.0
|   '-- flutter...
|-- flutter_launcher_icons 0.9.2
|   |-- args...
|   |-- image 3.1.1
|   |   |-- archive 3.1.11
|   |   |   |-- crypto...
|   |   |   '-- path...
|   |   |-- meta...
|   |   '-- xml...
|   |-- path...
|   '-- yaml 3.1.0
|       |-- collection...
|       |-- source_span...
|       '-- string_scanner...
|-- flutter_loggy_dio 2.0.0+3
|   |-- dio...
|   |-- flutter...
|   '-- loggy...
|-- flutter_platform_widgets 1.20.0
|   '-- flutter...
|-- flutter_secure_storage 5.0.2
|   |-- flutter...
|   |-- flutter_secure_storage_linux 1.1.0
|   |   |-- flutter...
|   |   '-- flutter_secure_storage_platform_interface...
|   |-- flutter_secure_storage_macos 1.1.0
|   |   |-- flutter...
|   |   '-- flutter_secure_storage_platform_interface...
|   |-- flutter_secure_storage_platform_interface 1.0.0
|   |   |-- flutter...
|   |   '-- plugin_platform_interface...
|   |-- flutter_secure_storage_web 1.0.2
|   |   |-- flutter...
|   |   |-- flutter_secure_storage_platform_interface...
|   |   |-- flutter_web_plugins...
|   |   '-- js...
|   |-- flutter_secure_storage_windows 1.1.2
|   |   |-- flutter...
|   |   '-- flutter_secure_storage_platform_interface...
|   '-- meta...
|-- flutter_svg 1.0.3
|   |-- flutter...
|   |-- meta...
|   |-- path_drawing 1.0.0
|   |   |-- flutter...
|   |   |-- meta...
|   |   |-- path_parsing 1.0.0
|   |   |   |-- meta...
|   |   |   '-- vector_math...
|   |   '-- vector_math...
|   |-- vector_math...
|   '-- xml 5.3.1
|       |-- collection...
|       |-- meta...
|       '-- petitparser 4.4.0
|           '-- meta...
|-- font_awesome_flutter 10.1.0
|   '-- flutter...
|-- freezed_annotation 2.0.3
|   |-- collection...
|   |-- json_annotation...
|   '-- meta...
|-- get 4.6.1
|   '-- flutter...
|-- get_it 7.2.0
|   |-- async 2.8.2
|   |   |-- collection...
|   |   '-- meta...
|   '-- collection...
|-- image_cropper 2.0.2
|   |-- flutter...
|   |-- image_cropper_for_web 0.0.3
|   |   |-- flutter...
|   |   |-- flutter_web_plugins...
|   |   |-- image_cropper_platform_interface...
|   |   '-- js...
|   '-- image_cropper_platform_interface 2.0.0
|       |-- flutter...
|       |-- http...
|       '-- plugin_platform_interface...
|-- image_picker 0.8.4+7
|   |-- flutter...
|   |-- flutter_plugin_android_lifecycle...
|   |-- image_picker_for_web 2.1.5
|   |   |-- flutter...
|   |   |-- flutter_web_plugins...
|   |   |-- image_picker_platform_interface...
|   |   '-- pedantic...
|   '-- image_picker_platform_interface 2.4.3
|       |-- cross_file...
|       |-- flutter...
|       |-- http...
|       '-- plugin_platform_interface...
|-- injectable 1.5.3
|   '-- get_it...
|-- intl 0.17.0
|   |-- clock...
|   '-- path...
|-- json_annotation 4.4.0
|   '-- meta...
|-- kt_dart 0.10.0
|   '-- meta...
|-- local_auth 2.0.2
|   |-- flutter...
|   |-- intl...
|   |-- local_auth_android 1.0.4
|   |   |-- flutter...
|   |   |-- flutter_plugin_android_lifecycle...
|   |   |-- intl...
|   |   '-- local_auth_platform_interface...
|   |-- local_auth_ios 1.0.5
|   |   |-- flutter...
|   |   |-- intl...
|   |   '-- local_auth_platform_interface...
|   '-- local_auth_platform_interface 1.0.3
|       |-- flutter...
|       |-- intl...
|       '-- plugin_platform_interface...
|-- logger 1.1.0
|-- loggy 2.0.1+1
|   '-- stack_trace 1.10.0
|       '-- path...
|-- modal_bottom_sheet 2.0.1
|   '-- flutter...
|-- objectbox 1.5.0
|   |-- collection...
|   |-- ffi 1.1.2
|   |-- flat_buffers 2.0.5
|   |-- meta...
|   '-- path...
|-- objectbox_flutter_libs 1.5.0
|   |-- objectbox...
|   '-- path_provider...
|-- path_provider 2.0.9
|   |-- flutter...
|   |-- path_provider_android 2.0.11
|   |   |-- flutter...
|   |   '-- path_provider_platform_interface...
|   |-- path_provider_ios 2.0.7
|   |   |-- flutter...
|   |   '-- path_provider_platform_interface...
|   |-- path_provider_linux 2.1.5
|   |   |-- ffi...
|   |   |-- flutter...
|   |   |-- path...
|   |   |-- path_provider_platform_interface...
|   |   '-- xdg_directories 0.2.0+1
|   |       |-- meta...
|   |       |-- path...
|   |       '-- process 4.2.4
|   |           |-- file...
|   |           |-- path...
|   |           '-- platform...
|   |-- path_provider_macos 2.0.5
|   |   |-- flutter...
|   |   '-- path_provider_platform_interface...
|   |-- path_provider_platform_interface 2.0.3
|   |   |-- flutter...
|   |   |-- platform 3.1.0
|   |   '-- plugin_platform_interface...
|   '-- path_provider_windows 2.0.5
|       |-- ffi...
|       |-- flutter...
|       |-- path...
|       |-- path_provider_platform_interface...
|       '-- win32 2.3.11
|           '-- ffi...
|-- percent_indicator 4.0.0
|   '-- flutter...
|-- photo_manager 2.1.0+1
|   '-- flutter...
|-- provider 6.0.2
|   |-- collection...
|   |-- flutter...
|   '-- nested 1.0.0
|       '-- flutter...
|-- pull_to_refresh 2.0.0
|   '-- flutter...
|-- qr_mobile_vision 3.0.1
|   |-- flutter...
|   '-- native_device_orientation 1.0.0
|       |-- flutter...
|       '-- meta...
|-- reorderables 0.5.0
|   '-- flutter...
|-- retrofit 3.0.1+1
|   |-- dio...
|   '-- meta...
|-- rxdart 0.27.3
|-- shared_preferences 2.0.13
|   |-- flutter...
|   |-- shared_preferences_android 2.0.10
|   |   |-- flutter...
|   |   '-- shared_preferences_platform_interface...
|   |-- shared_preferences_ios 2.0.9
|   |   |-- flutter...
|   |   '-- shared_preferences_platform_interface...
|   |-- shared_preferences_linux 2.0.4
|   |   |-- file...
|   |   |-- flutter...
|   |   |-- path...
|   |   |-- path_provider_linux...
|   |   '-- shared_preferences_platform_interface...
|   |-- shared_preferences_macos 2.0.2
|   |   |-- flutter...
|   |   '-- shared_preferences_platform_interface...
|   |-- shared_preferences_platform_interface 2.0.0
|   |   '-- flutter...
|   |-- shared_preferences_web 2.0.3
|   |   |-- flutter...
|   |   |-- flutter_web_plugins...
|   |   '-- shared_preferences_platform_interface...
|   '-- shared_preferences_windows 2.0.4
|       |-- file...
|       |-- flutter...
|       |-- path...
|       |-- path_provider_platform_interface...
|       |-- path_provider_windows...
|       '-- shared_preferences_platform_interface...
|-- shimmer 2.0.0
|   '-- flutter...
|-- smooth_page_indicator 1.0.0+2
|   '-- flutter...
|-- sticky_grouped_list 2.1.0
|   |-- flutter...
|   '-- scrollable_positioned_list 0.2.3
|       |-- collection...
|       '-- flutter...
|-- styled_widget 0.4.0+3
|   |-- flutter...
|   '-- lint 1.8.2
|-- textfield_tags 2.0.0+1
|   '-- flutter...
|-- tuple 2.0.0
|   '-- quiver...
|-- url_launcher 6.0.18
|   |-- flutter...
|   |-- url_launcher_android 6.0.15
|   |   |-- flutter...
|   |   '-- url_launcher_platform_interface...
|   |-- url_launcher_ios 6.0.15
|   |   |-- flutter...
|   |   '-- url_launcher_platform_interface...
|   |-- url_launcher_linux 2.0.4
|   |   |-- flutter...
|   |   '-- url_launcher_platform_interface...
|   |-- url_launcher_macos 2.0.4
|   |   |-- flutter...
|   |   '-- url_launcher_platform_interface...
|   |-- url_launcher_platform_interface 2.0.5
|   |   |-- flutter...
|   |   '-- plugin_platform_interface...
|   |-- url_launcher_web 2.0.8
|   |   |-- flutter...
|   |   |-- flutter_web_plugins...
|   |   '-- url_launcher_platform_interface...
|   '-- url_launcher_windows 2.0.3
|       |-- flutter...
|       '-- url_launcher_platform_interface...
|-- uuid 3.0.5
|   '-- crypto...
'-- webview_flutter 3.0.0
    |-- flutter...
    |-- webview_flutter_android 2.8.2
    |   |-- flutter...
    |   '-- webview_flutter_platform_interface...
    |-- webview_flutter_platform_interface 1.8.1
    |   |-- flutter...
    |   '-- plugin_platform_interface...
    '-- webview_flutter_wkwebview 2.7.1
        |-- flutter...
        '-- webview_flutter_platform_interface...
  • flutter doctor -v:
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.0.1 21A559 darwin-x64, locale en-GB)
    • Flutter version 3.0.0 at /Users/alextarana/development/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision ee4e09cce0 (9 days ago), 2022-05-09 16:45:18 -0700
    • Engine revision d1b9a6938a
    • Dart version 2.17.0
    • DevTools version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
    • Android SDK at /Users/alextarana/Library/Android/sdk
    • Platform android-31, build-tools 32.1.0-rc1
    • ANDROID_SDK_ROOT = /Users/alextarana/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.67.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.40.0

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • macOS 12.0.1 21A559 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 101.0.4951.64
    ! Error: Unable to prepare Alex iPhone for development.  (code -1)

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Steps to reproduce

  1. Create a flutter project and import the code below
  2. Try to use flutter pub run build_runner build --delete-conflicting-outputs
  3. Nothing happens

Expected behavior

Should generate objectbox-model.json and objectbox.g.json.

Code

import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:objectbox/objectbox.dart';

part 'otodbs.freezed.dart';

@freezed
class BrandOtoDb with _$BrandOtoDb {
  @Entity(realClass: BrandOtoDb)
  factory BrandOtoDb({
    @Id(assignable: true) required int? id,
    @Unique(onConflict: ConflictStrategy.replace) required String name,
  }) = _BrandOtoDb;
}

@freezed
class InfoOtoDb with _$InfoOtoDb {
  @Entity(realClass: InfoOtoDb)
  factory InfoOtoDb({
    @Id(assignable: false) required int? id,
    required String sentricId,
    required String name,
    required String title,
    required String subtitle,
    required String image,
  }) = _InfoOtoDb;
}

@freezed
class MediaGalleryOtoDb with _$MediaGalleryOtoDb {
  @Entity(realClass: MediaGalleryOtoDb)
  factory MediaGalleryOtoDb({
    @Id(assignable: true) required int? id,
    @Unique() required String url,
    required bool validated,
    // required ToOne<ProductOtoDb> product,
    // required ToOne<VariantOtoDb> variant,
    // required ToOne<PreviewVariantOtoDb> previewVariant,
    // required ToOne<PreviewProductOtoDb> previewProduct,
  }) = _MediaGalleryOtoDb;
}

@freezed
class PreviewProductOtoDb with _$PreviewProductOtoDb {
  @Entity(realClass: PreviewProductOtoDb)
  const factory PreviewProductOtoDb({
    @Id(assignable: true) required int? id,
    required String? sentricId,
    required String? parent,
    required bool validated,
    required String? option1Name,
    required String? option2Name,
    required String? category,
    required String? brand,
    required String? customProductBarcode,
    required String title,
    required String? description,
    required String? descriptionValidated,
    required List<String> barcodes,
    // @Backlink('previewProduct')
    required ToMany<PreviewVariantOtoDb> variants,
    // @Backlink('previewProduct')
    required ToMany<MediaGalleryOtoDb> mediaGallery,
    required int? quantity,
    required String ownerShop,
    @Property(type: PropertyType.date) required DateTime updatedDate,
    required double? price,
    required double? priceComparison,
  }) = _PreviewProductOtoDb;
}

@freezed
class PreviewVariantOtoDb with _$PreviewVariantOtoDb {
  @Entity(realClass: PreviewVariantOtoDb)
  factory PreviewVariantOtoDb({
    @Id(assignable: true) required int? id,
    required String? parent,
    required String? sentricId,
    required String? option1Value,
    required String? option2Value,
    required List<String> barcodes,
    required int? imageIndex,
    required int? quantity,
    required bool? validated,
    required double? price,
    required String? customProductBarcode,
    required ToOne<ProductOtoDb> product,
    // @Backlink('previewVariant')
    required ToMany<MediaGalleryOtoDb> mediaGallery,
    required double? priceComparison,
    @Property(type: PropertyType.date) required DateTime updatedDate,
  }) = _PreviewVariantOtoDb;
}

@freezed
class ProductOtoDb with _$ProductOtoDb {
  @Entity(realClass: ProductOtoDb)
  factory ProductOtoDb({
    @Id(assignable: true) required int? id,
    required String? sentricId,
    required String? parent,
    required bool validated,
    required String? option1Name,
    required String? option2Name,
    required String? category,
    required String? brand,
    required String? customProductBarcode,
    required String title,
    required String? description,
    required String? descriptionValidated,
    required List<String> barcodes,
    // @Backlink('product')
    required ToMany<VariantOtoDb> variants,
    // @Backlink('product')
    required ToMany<MediaGalleryOtoDb> mediaGallery,
    required int? quantity,
    required String ownerShop,
    @Property(type: PropertyType.date) required DateTime updatedDate,
    required double? price,
    required double? priceComparison,
  }) = _ProductOtoDb;
}

@freezed
class ProductReferenceOtoDb with _$ProductReferenceOtoDb {
  @Entity(realClass: ProductReferenceOtoDb)
  factory ProductReferenceOtoDb({
    @Id(assignable: true) required int? id,
    required List<String> barcodes,
  }) = _ProductReferenceOtoDb;
}

@freezed
class VariantOtoDb with _$VariantOtoDb {
  @Entity(realClass: VariantOtoDb)
  factory VariantOtoDb({
    @Id(assignable: true) required int? id,
    required String? parent,
    required String? sentricId,
    required String? option1Value,
    required String? option2Value,
    required List<String> barcodes,
    required int? imageIndex,
    required int? quantity,
    required bool? validated,
    required double? price,
    required String? customProductBarcode,
    required ToOne<ProductOtoDb> product,
    // @Backlink('variant')
    required ToMany<MediaGalleryOtoDb> mediaGallery,
    required double? priceComparison,
    @Property(type: PropertyType.date) required DateTime updatedDate,
  }) = _VariantOtoDb;
}

Here's my pubspec.yaml:

environment:
  sdk: ">=2.14.0 <3.0.0"

dependencies:
  animated_check: ^1.0.5
  animated_text_kit: ^4.2.1
  another_flushbar: ^1.10.28
  auto_route: ^4.0.1
  cached_network_image: ^3.1.0+1
  camera: ^0.9.4+10
  carousel_slider: ^4.0.0
  charcode: ^1.3.1
  connectivity_plus: ^2.2.1
  crypto: ^3.0.1
  cupertino_icons: ^1.0.4
  dart_jsonwebtoken: ^2.4.0
  dartz: ^0.10.1
  dio: ^4.0.6
  dio_smart_retry: ^1.2.0
  easy_localization: ^3.0.0
  encrypt: ^5.0.1
  english_words: ^4.0.0
  equatable: ^2.0.3
  flutter:
    sdk: flutter
  flutter_bloc: ^8.0.1
  flutter_image_compress: ^1.1.0
  flutter_launcher_icons: ^0.9.2
  flutter_loggy_dio: ^2.0.0+3
  flutter_platform_widgets: ^1.20.0
  flutter_secure_storage: ^5.0.2
  flutter_svg: ^1.0.3
  font_awesome_flutter: ^10.1.0
  freezed_annotation: ^2.0.3
  get: ^4.6.1
  get_it: ^7.2.0
  image_cropper: ^2.0.2
  image_picker: ^0.8.4+4
  injectable: ^1.5.3
  intl: ^0.17.0
  json_annotation: ^4.4.0
  kt_dart: ^0.10.0
  local_auth: ^2.0.2
  logger: ^1.1.0
  loggy: ^2.0.1+1
  modal_bottom_sheet: ^2.0.1
  objectbox: ^1.5.0
  objectbox_flutter_libs: ^1.5.0
  path_provider: ^2.0.9
  percent_indicator: ^4.0.0
  photo_manager: ^2.1.0+1
  provider: ^6.0.1
  pull_to_refresh: ^2.0.0
  qr_mobile_vision: ^3.0.1
  reorderables: ^0.5.0
  retrofit: ^3.0.1+1
  rxdart: ^0.27.3
  shared_preferences: ^2.0.8
  shimmer: ^2.0.0
  smooth_page_indicator: ^1.0.0+2
  sticky_grouped_list: ^2.1.0
  styled_widget: ^0.4.0+3
  textfield_tags: ^2.0.0+1
  tuple: ^2.0.0
  url_launcher: ^6.0.17
  uuid: ^3.0.5
  webview_flutter: ^3.0.0

dev_dependencies:
  auto_route_generator: ^4.0.0
  build_runner: ^2.0.0
  flutter_test:
    sdk: flutter
  freezed: ^2.0.3+1
  injectable_generator: ^1.5.3
  json_serializable: ^6.1.4
  lint: ^1.1.1
  objectbox_generator: ^1.5.0
  retrofit_generator: null

flutter_icons:
  ios: true
  android: "launcher_icon"
  image_path: "assets/logoApp.png"

flutter:
  uses-material-design: true

  fonts:
    - family: Avenir Next
      fonts:
        - asset: assets/fonts/regular.otf
          weight: 100
        - asset: assets/fonts/regular.otf
          weight: 300
        - asset: assets/fonts/medium.otf
          weight: 500
        - asset: assets/fonts/demiBold.otf
          weight: 700
        - asset: assets/fonts/bold.otf
          weight: 800
        - asset: assets/fonts/bold.otf
          weight: 900

  assets:
    - assets/
    - assets/languages/

  • Did you find any workarounds to prevent the issue? Using flutter pub run build_runner watch --delete-conflicting-outputs and changing just one of the entity's @Id(assignable: ) from true to false does the trick sometimes.

atarana avatar May 18 '22 22:05 atarana

I faced the same issue, there is some kind of conflict with auto_route generator https://github.com/objectbox/objectbox-dart/issues/414

awaik avatar May 19 '22 13:05 awaik

@awaik Thanks for answering! My comment also applies here: if you ever find out if this is because something ObjectBox can improve, let us know!

greenrobot-team avatar May 23 '22 08:05 greenrobot-team

Without additional information, we are unfortunately not sure how to resolve this issue. Therefore this issue has been automatically closed. Feel free to comment with additional details and we can re-open this issue.

github-actions[bot] avatar Jun 14 '22 02:06 github-actions[bot]

In my case it happens because objectbox runs BEFORE freezed. You can verify it here: .dart_tool/build/entrypoint/build.dart After manual order changing it works if you run this dart file manually. But build_runner re-creates the old order. So far I did not find how to order builders.

EvgeniShmakov avatar Aug 20 '22 13:08 EvgeniShmakov

In my case it happens because objectbox runs BEFORE freezed. You can verify it here: .dart_tool/build/entrypoint/build.dart After manual order changing it works if you run this dart file manually. But build_runner re-creates the old order. So far I did not find how to order builders.

Resolved this issue by extending runs_before parameter for freezed package (freezed/packages/freezed/build.yaml): runs_before: ["json_serializable|json_serializable", "objectbox_generator|resolver", "objectbox_generator|generator"]

vlado-rudenok avatar Sep 07 '22 09:09 vlado-rudenok

@vlado-rudenok Are you planning on doing PR to freezed package with that?

jakoss avatar Sep 07 '22 09:09 jakoss

The freezed author commented that

If you want to make a code generator that runs after Freezed, you can do that inside your own build.yaml instead of Frrezed's You might want to edit Object Box's build.yaml to tell it to run after Freezed

So to support ordering with any other code generator, is it possible to define order of generators in a custom build.yaml file (e.g. we could provide an example for freezed)? Or do we need to ship this change in our library? https://github.com/dart-lang/build/blob/master/build_config/README.md#adjusting-builder-ordering

greenrobot-team avatar Oct 04 '22 12:10 greenrobot-team

Just stumbled onto this, so leaving it here: https://github.com/dart-lang/build/blob/master/docs/faq.md#how-can-i-adjust-builder-ordering says it's possible to define ordering in your build.yaml file:

global_options:
  freezed:freezed:
    runs_before:
      - objectbox_generator:resolver

With this it should be possible to make freezed run before the ObjectBox generator. Will have a look.

greenrobot-team avatar Jan 09 '23 11:01 greenrobot-team

Is there any clarity on the plans to support these global_options?

endasan avatar Feb 02 '23 09:02 endasan

@endasan If it works, this is not something the ObjectBox package can fix. We could only provide documentation on how to add this to a build.yaml file in your package.

greenrobot-team avatar Feb 06 '23 10:02 greenrobot-team