flutter ListView scroll to index not available

Unfortunately, ListView has no built-in approach to a scrollToIndex() function. You’ll have to develop your own way to measure to that element’s offset for animateTo() or jumpTo(), or you can search through these suggested solutions/plugins or from other posts like Flutter: Scrolling to a widget in ListView (the general scrollToIndex issue is discussed at flutter/issues/12319 … Read more

how to convert an image to base64 image in flutter?

I just changed my code as follows, import ‘dart:convert’; List<int> imageBytes = widget.fileData.readAsBytesSync(); print(imageBytes); String base64Image = base64Encode(imageBytes); and this is working fine now. It is better to read it asynchronously as the image can be very large which may cause blocking of the main thread List<int> imageBytes = await widget.fileData.readAsBytes();

Persisting AppBar Drawer across all Pages Flutter

There are a few different options for this. The most basic is hopefully something you’ve already done, but I’ll list it anyways: 1: Create a class for your drawer Your widget should be its own stateful or stateless widget. This way, you just have to instantiate it each time. class MyDrawer extends StatelessWidget { @override … Read more

Dartlang wait more than one future

You can use Future.wait to wait for a list of futures: import ‘dart:async’; Future main() async { var data = []; var futures = <Future>[]; for (var d in data) { futures.add(d.loadData()); } await Future.wait(futures); } DartPad example