notube-export/lib/states/dlFormState.dart

26 lines
562 B
Dart

import 'package:flutter/material.dart';
import 'package:notube/services/download.dart';
class DlFormState extends ChangeNotifier {
String url =
'https://youtu.be/playlist?list=PLk1fi9OrZmvGBdh9BdWIhZImGVDUqls1X';
String format = 'MP3';
late DLServices dlService;
void setUrl(String newUrl) {
url = newUrl;
notifyListeners();
}
void setFormat(String newFormat) {
format = newFormat;
notifyListeners();
}
Future<void> download() async {
dlService = await DLServices.init();
await dlService.analyseUrl(url);
}
}