CoursesCubit class
Os cursos instalados (BL17, antes CourseStore). Os bytes ficam num
LibraryBlobStore (arquivo, IndexedDB ou memória) por course:<id>; a
lista, em shared_preferences (course_installed). Quem mostra a lista
escuta stream (ou lê state).
- Inheritance
-
- Object
- BlocBase<
CoursesState> - Cubit<
CoursesState> - CoursesCubit
Constructors
- CoursesCubit({required AppClock clock, LibraryBlobStore? blobs, SharedPreferencesAsync? prefs, Uint8List? publicKey})
Properties
- clock → AppClock
-
O relógio do app (CT05d): a hora em que um curso entra na lista.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
installed
→ List<
InstalledCourse> -
Em ordem de instalação.
no setter
- isClosed → bool
-
Whether the bloc is closed.
no setterinherited
- publicKey → Uint8List?
-
A chave pública que abre os pacotes (
nullsem chave no build): o despacho do instalador usa esta ou a das bibliotecas (a mesma pessoa assina os dois, D-LIC-CONFIANCA).no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → CoursesState
-
The current state.
no setterinherited
-
stream
→ Stream<
CoursesState> -
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(
CoursesState state) → void -
Updates the
stateto the providedstate. emit does nothing if thestatebeing emitted is equal to the currentstate.inherited -
inspect(
Uint8List bytes) → Future< Course> -
Valida
bytes(assinatura, cifra e conteúdo) sem gravar nada: a tela usa isto para conferir o pacote e perguntar antes de substituir um curso instalado. Qualquer problema viraLibraryFormatExceptioncom a mensagem pronta para a tela. -
install(
Uint8List bytes, {Course? inspected}) → Future< InstalledCourse> -
Valida
bytes(assinatura, cifra e conteúdo) antes de gravar; se falhar, nada muda. Umidjá instalado é substituído — quem pergunta ao usuário antes é a tela. O progresso fica (é por id de curso, noCourseProgressCubit, que este cubit nem toca). -
load(
) → Future< void> - Lê a lista das preferências. O que está na lista mas não tem pacote (arquivo apagado, dados do site limpos) sai dela.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onChange(
Change< CoursesState> 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 -
open(
String id) → Future< LoadedCourse?> -
Abre o curso de
id(assinatura, cifra e conteúdo) ounullse não está instalado ou não abre mais. -
openAll(
) → Future< List< LoadedCourse> > - Todos os instalados que ainda abrem, na ordem da lista.
-
openEnvelope(
Uint8List sealed) → Future< Uint8List> - Abre o envelope (assinatura e cifra) e devolve os bytes do zip, sem validar o conteúdo: o despacho do instalador usa isto para separar curso de biblioteca antes de chamar cada fluxo.
-
read(
String id) → Future< Uint8List?> -
Os bytes do pacote de
id, como foram instalados (o envelope). -
remove(
String id) → Future< void> - Apaga o pacote e tira da lista; o progresso fica (para o caso de reinstalar).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
String? id) → InstalledCourse?