This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When QuerySets are evaluated | |
You can concatenate as many filters as you like to a QuerySet, and you will not hit the database until the QuerySet is evaluated. QuerySets are only evaluated in the following cases: | |
The first time you iterate over them | |
When you slice them, for instance, Post.objects.all()[:3] | |
When you pickle or cache them | |
When you call repr() or len() on them | |
When you explicitly call list() on them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from multiprocessing.pool import ThreadPool | |
from time import time | |
import wget | |
urlp = "https://picsum.photos/id/{}/720/1200" | |
urls = [(urlp.format(x), "{}.jpg".format(x)) for x in range(10)] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Future<Null> _downloadNetworkImage() async { | |
Dio dio = Dio(); | |
try { | |
var dir = await getTemporaryDirectory(); | |
print(dir); | |
Scaffold.of(context).showSnackBar( | |
SnackBar(content: Text("Downloading image. Please wait..."))); | |
await dio.download(url, '${dir.path}/image.jpeg', | |
onReceiveProgress: (rec, total) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bottomNavigationBar: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Container( | |
decoration: BoxDecoration(boxShadow: [ | |
BoxShadow( | |
blurRadius: 4.0, | |
offset: Offset(0.0, 0.0), | |
color: Colors.grey, | |
), | |
], borderRadius: BorderRadius.circular(36.0)), |