Customizable, performant and vendor-free vector and raster maps, flutter wrapper for maplibre-native and maplibre-gl-js (fork of flutter-mapbox-gl/maps)
Since starting to use expressions more in my layers some utility functions to create them could be nice to have. This could improve the readability of them since the map expressions can become hard to read very fast.
This could be a time-consuming task to get done. but nice to have in my opinion.
I already have some examples since I use them in a personal project.
List ifelseCase({required final Map cases, required final defValue}) {
final flattened = cases.entries.map((final element) {
return [element.key, element.value];
}).flatten;
return ['case', ...flattened, defValue];
}
List boolean(final String property, {final bool value = true}) {
return ['boolean', has(property), value];
}
List match({
required final value,
required final Map matches,
required final defValue,
}) {
final flattened = matches.entries.map((final element) {
return [element.key, element.value];
}).flatten;
return ['match', value, ...flattened, defValue];
}
List get(final String name, [final expression]) {
return ['get', name, if (expression != null) expression];
}
final sort = ifelseCase(
cases: {
boolean('category'): match(
value: get('category'),
matches: {
'first': 1,
'second': 2,
},
defValue: 0,
),
},
defValue: 0,
);
Feature Description
Since starting to use expressions more in my layers some utility functions to create them could be nice to have. This could improve the readability of them since the map expressions can become hard to read very fast.
This could be a time-consuming task to get done. but nice to have in my opinion.
I already have some examples since I use them in a personal project.
Describe alternatives you've considered
No response
Additional context
No response