32 lines
626 B
Dart
32 lines
626 B
Dart
import 'package:bloc/bloc.dart';
|
|
import 'package:equatable/equatable.dart';
|
|
import 'package:notube/services/download.dart';
|
|
|
|
import 'dart:developer';
|
|
|
|
part 'dl_form_state.dart';
|
|
|
|
class DlFormCubit extends Cubit<DlFormState> {
|
|
DlFormCubit() : super(DlFormInitial());
|
|
|
|
late DLServices dlService;
|
|
|
|
void setFormat(String newFormat) {
|
|
emit(state.copyWith(
|
|
format: newFormat,
|
|
));
|
|
print(newFormat);
|
|
}
|
|
|
|
void setUrl(String newUrl) {
|
|
emit(state.copyWith(
|
|
url: newUrl,
|
|
));
|
|
}
|
|
|
|
void download() async {
|
|
dlService = await DLServices.init();
|
|
await dlService.analyseUrl(state.url!);
|
|
}
|
|
}
|