getSegments static method
Returns a list of the segments.
Implementation
static Future<Map<int, List<int>>?> getSegments() async {
Map? untypedSegments = await _methodChannel.invokeMethod('getSegments');
if (untypedSegments == null) return null;
Map<int, List<int>> typedSegments = {};
untypedSegments.forEach((key, value) {
if (key is int && value is List) {
bool areAllInt = value.every((element) => element is int);
if (areAllInt) {
typedSegments[key] = List<int>.from(value);
}
}
});
return typedSegments;
}