mobx.dart icon indicating copy to clipboard operation
mobx.dart copied to clipboard

[Flutter] toString method generation overrides my toString functionality.

Open Malik056 opened this issue 3 years ago • 2 comments
trafficstars

code generation generates the no needed toString method and make my build break.

Is there anyway to disable automatic toString code in generation *.g .dart file?

Malik056 avatar Feb 19 '22 06:02 Malik056

@Malik056 Use @StoreConfig.

@StoreConfig(hasToString: false)
class YourStore = _YourStore with _$YourStore;

abstract class _YourStore with Store {
}

amondnet avatar Mar 07 '22 05:03 amondnet

Thank you @amondnet. It is worth stating that as of March 2022, suppressing the toString() method is the only use for, and parameter of, StoreConfig.

Currently the only configuration used is boolean to indicate generation of toString method (true), or not (false)

https://github.com/mobxjs/mobx.dart/blob/master/mobx/lib/src/api/annotations.dart

2x2xplz avatar Mar 10 '22 20:03 2x2xplz