mobxjs / mobx.dart

MobX for the Dart language. Hassle-free, reactive state-management for your Dart and Flutter apps.
https://mobx.netlify.app
MIT License
2.4k stars 310 forks source link

REQUEST: This requires the `super-parameters` language feature to be enabled. #807

Closed offline-first closed 2 years ago

offline-first commented 2 years ago

Please support the new language feature for "super-parameters" sdk ^2.17.0

fzyzcjy commented 2 years ago

What error are you having?

offline-first commented 2 years ago

This builder requires Dart inputs without syntax errors. However, package:test/models/test.dart (or an existing part) contains the following errors. test.dart:11:8: This requires the 'super-parameters' language feature to be enabled.

class BaseTest {
  final String id;
  BaseTest(this.id);
}

class Test extends BaseTest{
  final String title;
  Test(super.id, this.title);
}
offline-first commented 2 years ago

To enable this feature, just change the line in .../mobx/pubspec.yaml

sdk: '>=2.13.0 <3.0.0'

to

sdk: '>=2.17.0 <3.0.0'
shilangyu commented 2 years ago

This error is because of the analyzer constraint, it is not related to the dart sdk constraint: https://github.com/mobxjs/mobx.dart/blob/9c4eb1dbd99228cbc11425b59472f6142b3816fd/mobx_codegen/pubspec.yaml#L11

To be exact: people depending on mobx_codegen are unable to upgrade to dart 2.17. Example of how freezed's pubspec looks like: https://github.com/rrousselGit/freezed/blob/master/packages/freezed/pubspec.yaml. Notice, that analyzer 4.0.0 is allowed in their constraint, unlike mobx_codegen's constraint.