CourseProgressCubit class
Guarda um progresso por curso (course_progress:<courseId>, JSON). Quem
mostra o progresso escuta stream (BL17, antes ChangeNotifier): a lista
refaz a linha do curso ao voltar da lição sem reabrir nada.
- Inheritance
-
- Object
- BlocBase<
CourseProgressState> - Cubit<
CourseProgressState> - CourseProgressCubit
- Implementers
Constructors
- CourseProgressCubit({SharedPreferencesAsync? prefs})
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → CourseProgressState
-
The current state.
no setterinherited
-
stream
→ Stream<
CourseProgressState> -
The current stream of states.
no setterinherited
Methods
-
addError(
Object error, [StackTrace? stackTrace]) → void -
Reports an
errorwhich triggers onError with an optional StackTrace.inherited -
close(
) → Future< void> -
Closes the instance.
This method should be called when the instance is no longer needed.
Once close is called, the instance can no longer be used.
inherited
-
emit(
CourseProgressState state) → void -
Updates the
stateto the providedstate. emit does nothing if thestatebeing emitted is equal to the currentstate.inherited -
ensureLoaded(
String courseId) → Future< CourseProgress> - Garante o curso na memória (uma chave só). Emite para a lista e a tela do curso mostrarem o progresso guardado ao abrir.
-
keyProgressOf(
String courseId, String exerciseId) → Future< Map< String, KeyRecord> > -
O progresso por tom de
exerciseIdno cursocourseId(EX05); vazio se nunca se tocou em tom nenhum ou se o armazenamento não responde. -
markLessonDone(
String courseId, String lessonId) → Future< void> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< CourseProgressState> change) → void -
Called whenever a
changeoccurs with the givenchange. Achangeoccurs when a newstateis emitted. onChange is called before thestateof thecubitis updated. onChange is a great spot to add logging/analytics for a specificcubit.inherited -
onError(
Object error, StackTrace stackTrace) → void -
Called whenever an
erroroccurs and notifies BlocObserver.onError.inherited -
recordAttempt(
String courseId, ExerciseSpec spec, RoundResult result, DateTime agora) → Future< void> -
Registra a rodada de
specno diaagora(o relógio de quem a termina). -
recordKeyRound(
String courseId, String exerciseId, RoundResult result, DateTime at) → Future< void> -
Grava uma rodada transposta (EX05): o tom (RoundResult.key, "Sol maior"),
a porcentagem e a hora
at. O mapa do exercício guarda, por tom, a melhor porcentagem e a última tentativa (Pike 25). Nada lê isso ainda; é a base do treino do dia. Rodada sem tom não grava nada; se não der para gravar, a rodada segue. -
renotificar(
) → void -
Emite um estado novo mesmo sem mudança de progresso (sobe o
serial). Só quem junta o progresso de outros caches usa (o rascunho na lista). -
setTempo(
String courseId, String exerciseId, int bpm) → Future< void> - Grava o andamento da próxima rodada da escada (EX22). Se não der para gravar, a rodada segue e a escada volta ao começo na próxima vez.
-
tempoOf(
String courseId, String exerciseId) → Future< int?> -
O andamento em que a escada de
exerciseIdestá agora (bpm), ounullse nunca se tocou ou o armazenamento não responde (a escada começa nofrom). Guardado à parte doExerciseRecord, como o progresso por tom (EX22). -
toString(
) → String -
A string representation of this object.
inherited
-
touchLesson(
String courseId, String lessonId) → Future< void>
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String courseId) → CourseProgress