Files
smooth-app/packages/smooth_app/lib/helpers/database_helper.dart
Edouard Marquez e3bc40fdf3 chore: Migration to Dart 3.8 (#6668)
* Migration to Dart 3.8

* New GA

* Fix dartdoc
2025-06-23 18:14:17 +02:00

19 lines
577 B
Dart

import 'package:smooth_app/database/dao_int.dart';
/// Returns a progressive number each time it is invoked for a given [key].
/// This is useful to generate a unique id for a given [key].
///
/// The [key] is a string that is used to identify the sequence.
///
/// The progressive number is saved in the database, so that it is persistent.
Future<int> getNextSequenceNumber(final DaoInt daoInt, final String key) async {
int? result = daoInt.get(key);
if (result == null) {
result = 1;
} else {
result++;
}
await daoInt.put(key, result);
return result;
}