class HomeScreen extends StatefulWidget {
@override
_HomeScreenState createState() => _HomeScreenState();
}
class _HomeScreenState extends State<HomeScreen> {
final booksDir = new Directory('/sdcard/Genesis Reader');
bool isDirectoryExistent = false;
List<String> bookPaths = [];
Stream fileStream;
final RegExp re = RegExp(r'(?<=Reader\/)(.*)(?=\.epub)');
@override
void initState() {
super.initState();
getDirStatus();
// EpubKitty.setConfig("book", "#232931", "vertical", true);
}
void getDirStatus() async {
await booksDir.exists().then((isThere) {
if (isThere) {
setState(() {
isDirectoryExistent = true;
});
fileStream = booksDir.list();
}
});
}
@override
Widget build(BuildContext context) {
// print(bookPaths);
return BaseScaffold(
subHeading: 'Downloaded Books',
searchWidget: SearchBar(),
mainWidget: isDirectoryExistent
? StreamBuilder(
stream: fileStream,
builder: (context, snapshot) {
if (snapshot.hasData) {
print('from print: ${snapshot.data}');
// return Text(snapshot.data.path);
}
return CircularProgressIndicator();
})
: NoBooks(),
);
}
}
--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/628f6129-703a-4019-b4f5-981afb95eaa6%40googlegroups.com.
ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: FileSystemException: File system watching is not supported on this platform, path = ''
String path = 'path/to/directory';
Directory dir = Directory(path);
var stream = dir.watch(events: FileSystemEvent.all);
stream.listen((data){
print(data.path);
});
To unsubscribe from this group and stop receiving emails from it, send an email to flutt...@googlegroups.com.
> The implementation uses platform-dependent event-based APIs for receiving file-system notifications, thus behavior depends on the platform.
Windows
: Uses ReadDirectoryChangesW
. The implementation only supports watching directories. Recursive watching is supported.Linux
: Uses inotify
. The implementation supports watching both files and directories. Recursive watching is not supported. Note: When watching files directly, delete events might not happen as expected.OS X
: Uses FSEvents
. The implementation supports watching both files and directories. Recursive watching is supported.To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/c6749232-6c2c-4ef4-8523-a20d36be234a%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/c6749232-6c2c-4ef4-8523-a20d36be234a%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/2e5ce7d1-ecc7-4a2d-a6aa-d212e9515ca6%40googlegroups.com.