How to use a Future with a Duration delay in Dart (and Flutter)

As a quick note, here are two examples of how to use a Future with a Duration delay in Dart (and Flutter):

// example 1
Future<bool> _getFutureBool() {
    return Future.delayed(Duration(milliseconds: 500))
        .then((onValue) => true);

// example 2
Future.delayed(const Duration(milliseconds: 500), () {
    print('Hello, world');

If you’re comfortable with Dart futures, you know that the second example will (eventually) print this output:

Hello, world

This is a page from my book, “How I Sold My Business: A Personal Diary”

Friday, October 7, 2005

I called my lawyer today to talk about a couple of things related to the business sale, and specifically mentioned the partners wanting to pay me 50% up front and 50% from the business revenue (an "earnout"). He repeated what he said earlier, and said I should absolutely not take that offer. He didn't give me any specific examples I can remember, but he said there are too many ways for people to wiggle out of deals like that, and all the money should come up front.

An Arduino Uno Hello, World program

Last night I finally got some time to work with my new Arduino Uno board, and created a little "Hello, world" program. This program is just the same "LED on Pin 13" program I see repeated in every book and on every website, but it really is helpful when you're struggling to get started with the Arduino hardware, like I was.

The AppleScript delay command

AppleScript command FAQ: Can you show an example of the AppleScript delay command?

If your AppleScript is running too fast you can slow it down with the delay command, like this example:

display dialog 1 buttons {"OK"}
delay 3
display dialog 2

When you click OK after the first dialog, your AppleScript program goes to sleep for three seconds, then displays the second dialog.

Hopefully you'll have more practical uses for this AppleScript sleep/delay command my sample code. :)