defaultBackgroundLayerPredicate function

bool defaultBackgroundLayerPredicate(
  1. Map<String, dynamic> layer
)

accepts layers that are:

  • of type background
  • of type fill that use source layer landcover or water

Implementation

bool defaultBackgroundLayerPredicate(Map<String, dynamic> layer) {
  final type = layer['type'];
  if (type == 'background') {
    return true;
  } else if (type == 'fill') {
    final sourceLayer = layer['source-layer'];
    return (sourceLayer == 'landcover' || sourceLayer == 'water');
  }
  return false;
}