code_field icon indicating copy to clipboard operation
code_field copied to clipboard

Delete CodeController.onChange

Open alexeyinkin opened this issue 1 year ago • 0 comments

CodeController.onChange can be replaced with

controller.addListener(() {
  final text = controller.rawText;
});

If we delete onChange(), the benefits are:

  • User code is less messy. If they use both ways to listen to changes, their code is hard to maintain.
  • Less code for us to maintain.
  • Following Flutter convention. Controllers are listened to, and widgets have onChanged because they are disposable and so cannot be listened to. Both TextField and CodeField have one.
  • More consistent API. CodeField.onChanged is called with dots with webSpaceFix while CodeController.onChange is called with spaces.

@BertrandBev still you added onChange after rawText, so I wander what was the motivation for it. Are you OK with deleting it in the next breaking release?

alexeyinkin avatar Jul 08 '22 05:07 alexeyinkin