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

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 (null sem 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 error which 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 state to the provided state. emit does nothing if the state being emitted is equal to the current state.
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 vira LibraryFormatException com 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. Um id já instalado é substituído — quem pergunta ao usuário antes é a tela. O progresso fica (é por id de curso, no CourseProgressCubit, 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 change occurs with the given change. A change occurs when a new state is emitted. onChange is called before the state of the cubit is updated. onChange is a great spot to add logging/analytics for a specific cubit.
inherited
onError(Object error, StackTrace stackTrace) → void
Called whenever an error occurs and notifies BlocObserver.onError.
inherited
open(String id) → Future<LoadedCourse?>
Abre o curso de id (assinatura, cifra e conteúdo) ou null se 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?

Static Methods

blobId(String courseId) → String
A chave do pacote no blob store (o mesmo das bibliotecas, com prefixo).

Constants

listKey → const String