Skip to content

Instantly share code, notes, and snippets.

@phrohdoh
Last active Aug 4, 2020
Embed
What would you like to do?
AutoPets Whisker mobile app snippets

fake activities for lib/litter/status/litter_status_tab.dart's _buildRecentActivitySection

    final fakeActivities = List<LitterRobotActivity>.from(
      LitterRobotUnitStatus.values.map(
        (unitStatus) => LitterRobotActivity(
          litterRobotId: 'x',
          unitStatus: unitStatus,
          timestamp: DateTime.now()
              .subtract(Duration(seconds: Random().nextInt(60 * 60 * 8))),
        ),
      ),
    );
    fakeActivities.sort((a, b) => b.timestamp.microsecondsSinceEpoch
        .compareTo(a.timestamp.microsecondsSinceEpoch));

replace the use of activitiesSnapshot.data with UnmodifiableListView(fakeActivities)

zsh function making flutter easier to use

fl () {
  local _tool='flutter'
  # set -x # enable logging for debugging

  case "$#" in
    0) $_tool ;;
    *) case "$1" in
        't'|'test') $_tool 'test' "${*[2,-1]}" ;;
        'r'|'run')  $_tool 'run'  "${*[2,-1]}" ;;
        *)          $_tool        "${*}"       ;;
       esac ;;
  esac

  # set +x # disable logging for debugging
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment