ParkingController class

Controller for managing parking locations visibility and state on the map.

This controller handles:

  • Parking locations visibility toggling
  • Parking layer state management
  • Real-time parking visibility updates

The controller provides simple parking visualization control through ParkingModel, allowing users to show or hide available parking locations on the map.

Usage example:

final controller = ParkingController(
  map: mapInstance,
);

// Toggle parking locations visibility
controller.toggleParking();

// Check if parking layer is active
print(controller.state.value.isActive);

// Listen to parking visibility changes
controller.state.addListener(() {
  final isVisible = controller.state.value.isActive;
  print('Parking locations are ${isVisible ? "visible" : "hidden"}');
});

The controller maintains a single subscription to parking visibility state and provides a simple toggle mechanism for parking locations visualization.

Remember to dispose of the controller when it's no longer needed:

controller.dispose();

Constructors

ParkingController.new({required Map map})

Properties

hashCode int
The hash code for this object.
no setterinherited
map Map
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state ValueNotifier<ParkingModel>
no setter

Methods

dispose() → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toggleParking() → void
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited