Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In flutter library provide a properties getters and setters in dart syntax, as a property, instead of methods get*() and set*() #972

Open
Nashev opened this issue Apr 27, 2024 · 1 comment
Labels
enhancement New feature or request flutter Affect flutter platform v6.0 wontfix This will not be worked on

Comments

@Nashev
Copy link

Nashev commented Apr 27, 2024

See https://dart-dev.web.app/language/methods#getters-and-setters to understand what I mean.

Now Your implementation contains access methods in form of pairs like this:

  static FFprobeSessionCompleteCallback? getGlobalFFprobeSessionCompleteCallback() => _ffprobeSessionCompleteCallback;

  static void setGlobalFFprobeSessionCompleteCallback(FFprobeSessionCompleteCallback? completeCallback) {
    _ffprobeSessionCompleteCallback = completeCallback;
  }

For backward compatibility I suggest to leave existing methods with @Deprecated() directive.
So I would like to see something like this in next few releases:

  static FFprobeSessionCompleteCallback? get globalFFprobeSessionCompleteCallback => _ffprobeSessionCompleteCallback;
  static set globalFFprobeSessionCompleteCallback(FFprobeSessionCompleteCallback? completeCallback) => 
      _ffprobeSessionCompleteCallback = completeCallback;

  @Deprecated('Use property globalFFprobeSessionCompleteCallback instead of this getter, it makes shorter code.')
  static FFprobeSessionCompleteCallback? getGlobalFFprobeSessionCompleteCallback() => globalFFprobeSessionCompleteCallback;

  @Deprecated('Use property globalFFprobeSessionCompleteCallback instead of this setter, it makes shorter code.')
  static void setGlobalFFprobeSessionCompleteCallback(FFprobeSessionCompleteCallback? completeCallback) {
    globalFFprobeSessionCompleteCallback = completeCallback;
  }

And finally leave only this:

  static FFprobeSessionCompleteCallback? get globalFFprobeSessionCompleteCallback => _ffprobeSessionCompleteCallback;

  static set globalFFprobeSessionCompleteCallback(FFprobeSessionCompleteCallback? completeCallback) =>
      _ffprobeSessionCompleteCallback = completeCallback;

It will allow use a form like

  FFmpegKitFactory.globalFFprobeSessionCompleteCallback = myMethod;
// and
  if (FFmpegKitFactory.globalFFprobeSessionCompleteCallback != null)

instead of

  FFmpegKitFactory.setGlobalFFprobeSessionCompleteCallback(myMethod);
// and 
  if (FFmpegKitFactory.getGlobalFFprobeSessionCompleteCallback() != null)

not so big changes, but it will more dart-styled code. It is worth.

@tanersener
Copy link
Collaborator

I do accept that some of the method names don't adhere to the language-specific best practices. However, this decision was intentional to maintain uniformity in method names across all platforms. We intend to stay behind this philosophy unless it compromises functionality at some point.

@tanersener tanersener added enhancement New feature or request wontfix This will not be worked on flutter Affect flutter platform v6.0 labels Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request flutter Affect flutter platform v6.0 wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants