Skip to content

Instantly share code, notes, and snippets.

@timsneath
Last active February 7, 2023 00:05

Revisions

  1. Tim Sneath revised this gist Feb 7, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions records-patterns.dart
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    // A simple example of records and patterns

    (double x, double y) getLocation(String name) {
    if (name == 'Nairobi') {
    return (1.2921, 36.8219);
  2. Tim Sneath created this gist Jan 25, 2023.
    13 changes: 13 additions & 0 deletions records-patterns.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    (double x, double y) getLocation(String name) {
    if (name == 'Nairobi') {
    return (1.2921, 36.8219);
    }
    else {
    return (0, 0);
    }
    }

    void main(List<String> args) {
    final (lat, long) = getLocation('Nairobi');
    print('Current location: $lat, $long');
    }