deprecated_ optional
                  Omitting an argument for the '{0}' parameter is deprecated.
Description
#
                    The analyzer produces this diagnostic when an argument is omitted for an
                    optional parameter annotated with @Deprecated.optional. This annotation
                    indicates that omitting an argument for the parameter is deprecated, and
                    the parameter will soon become required.
                  
Example
#
                    Given a library p that defines a function with an optional parameter
                    annotated with @Deprecated.optional:
                  
void f({@Deprecated.optional() int a = 0}) {}
                      
                      
                      
                    
                    The following code produces this diagnostic, because the invocation
                    doesn't pass a value for the parameter a:
                  
import 'package:p/p.dart';
void g() {
  f();
}
                      
                      
                      
                    Common fixes
#
                    Follow any specific instructions provided in the @Deprecated.optional
                    annotation.
                  
If no instructions are present, pass an appropriate argument for the corresponding parameter:
import 'package:p/p.dart';
void g() {
  f(a: 0);
}
                      
                      
                      
                    Using the default value will preserve the current behavior of the code.
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-11-4. View source or report an issue.