Versions
dart_mappable: 4.6.1
dart_mappable_builder: 4.6.1
Description
At least in case, when using typedef to enum from another module, mapper.dart files rely on original enum, instead of a typedef.
This results in a Error: Type 'OriginalEnum' not found. file.mapper.dart:259 OriginalEnumType
Example
Let's assume we have pub workspaces with 2 modules: module_a and module_b.
module_a contains next files:
validation_result.dart
@MappableEnum
enum ValidationResult {
valid, incorrectFormat, tooShort,
}
amount_validation_result.dart
import 'package:module_a/validation_result.dart';
typedef AmountValidationResult = ValidationResult
module_b contains next file:
bloc_state.dart
import 'package:module_a/amount_validation_result.dart';
part 'bloc_state.mapper.dart';
@MappableClass
class BlocState {
BlocState({required this.amountValidationResult}
final AmountValidationResult amountValidationResult
}
If we run dart run build_runner build -d in module_a and then in module_b, nothing will fail.
But if we try to build the app, compiler will return:
packages/module_b/bloc_state.mapper.dart:259:5: Error: Type 'ValidationResult' not found.
ValidationResult
^^^^^^^^^^^^^^^
Versions
dart_mappable: 4.6.1dart_mappable_builder: 4.6.1Description
At least in case, when using typedef to enum from another module,
mapper.dartfiles rely on original enum, instead of a typedef.This results in a
Error: Type 'OriginalEnum' not found. file.mapper.dart:259 OriginalEnumTypeExample
Let's assume we have pub workspaces with 2 modules:
module_aandmodule_b.module_acontains next files:validation_result.dartamount_validation_result.dartmodule_bcontains next file:bloc_state.dartIf we run
dart run build_runner build -dinmodule_aand then inmodule_b, nothing will fail.But if we try to build the app, compiler will return: