dart_sealed icon indicating copy to clipboard operation
dart_sealed copied to clipboard

Default values for fields

Open FatulM opened this issue 4 years ago • 2 comments

Add a capability to add default values for fields. for example like this:

import 'package:sealed_annotations/sealed_annotations.dart';

part 'weather.sealed.dart';

@Sealed()
abstract class _Weather {
  void sunny();

  void rainy({int rain = 10});

  void windy({@WithDefault('1e10') double velocity, double? angle = 100.0});
}

there is the question that if it should support dynamic defaults as well ?!

FatulM avatar Sep 04 '21 08:09 FatulM

@SaeedMasoumi

FatulM avatar Sep 04 '21 08:09 FatulM

There should be ability to set default values for common fields on constructor

FatulM avatar Sep 12 '21 08:09 FatulM