d-markey / squadron_builder

Dart code generator for Squadron workers. Implement your worker service and let squadron_builder bridge the gap with Web Workers and Isolates!
https://pub.dev/packages/squadron_builder
MIT License
15 stars 3 forks source link

Missing an explicit required modifier #17

Closed sabin26 closed 2 months ago

sabin26 commented 2 months ago

For a given squadron service:

@SquadronService(baseUrl: '/services/storage', wasm: true)
class KeyValueService {
  KeyValueService({required this.path});

  final String path;

  @SquadronMethod()
  Future<void> clear() async {}
}

Steps to Reproduce

dart compile wasm key_value_service.web.g.dart -o key_value_service.web.g.dart.wasm

Error

The parameter 'path' can't have a value of 'null' because of its type 'String', but the implicit default value is 'null'.

Solution

Try adding either an explicit non-'null' default value or the 'required' modifier. _$KeyValueServiceWorkerService({super.path}) : super();

squadron_builder_bug

d-markey commented 2 months ago

Thanks for the report, fixed.