Skip to content

Instantly share code, notes, and snippets.

@phrohdoh
Last active August 4, 2020 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phrohdoh/a6ca881b7cb4031885446d02bb2501bd to your computer and use it in GitHub Desktop.
Save phrohdoh/a6ca881b7cb4031885446d02bb2501bd to your computer and use it in GitHub Desktop.
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