getTimezones function

List<String> getTimezones()

Implementation

List<String> getTimezones() {
  final outLength = calloc<Int32>();
  try {
    final buf = _nativeGetTimezones(outLength);
    if (buf == nullptr) return const [];
    try {
      final str = buf.toDartString(length: outLength.value);
      return str.split('\n').where((s) => s.isNotEmpty).toList();
    } finally {
      _nativeFreeBuffer(buf.cast());
    }
  } finally {
    calloc.free(outLength);
  }
}