getGid method

Future<int> getGid()

Obtém o ID numérico da aba (GID) com cache para evitar chamadas extras

Implementation

Future<int> getGid() async {
  if (_cachedGid != null) return _cachedGid!;
  final ss = await api.spreadsheets.get(spreadsheetId);
  final sheet = ss.sheets?.firstWhere(
    (s) => s.properties?.title == sheetName,
    orElse: () => throw Exception("Aba $sheetName não encontrada."),
  );
  _cachedGid = sheet?.properties?.sheetId ?? 0;
  return _cachedGid!;
}