In flutter library provide a properties getters and setters in dart syntax, as a property, instead of methods get*() and set*()
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.
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.