includeNullQueryVars property
Set to true
to include query variables with null values. This includes nested maps.
The default is to exclude them.
NOTE: Empty strings are always included.
@Get(
path: '/script',
includeNullQueryVars: true,
)
Future<Response<String>> getData({
@Query('foo') String? foo,
@Query('bar') String? bar,
@Query('baz') String? baz,
});
final response = await service.getData(
foo: 'foo_val',
bar: null, // omitting it would have the same effect
baz: 'baz_val',
);
The above code produces hxxp://path/to/script&foo=foo_var&bar=&baz=baz_var
Implementation
final bool? includeNullQueryVars;