GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - ali-raza-fa22/github-user-activity: Dart CLI project for displaying GitHub user activity

BranchesTags
Open more actions menu

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
bin
bin
 
 
lib
lib
 
 
test
test
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
README.md
README.md
 
 
analysis_options.yaml
analysis_options.yaml
 
 
pubspec.lock
pubspec.lock
 
 
pubspec.yaml
pubspec.yaml
 
 

Repository files navigation

A sample command-line application with an entrypoint in bin/, library code in lib/.

Same Solution for github-user-activvity chanllenge from roadmap.sh

clone this project:

git clone https://github.com/ali-raza-fa22/github-user-activity.git
cd github-user-activity
dart pub get

Pre-requisities:

dependencies:
  http: ^0.13.0

and then run dart pub get.

This will also add dependency.

Usage

dart run bin/main.dart <username>

Example:

dart run bin/main.dart ali-raza-fa22

Notes:

GET API example

final url = Uri.parse("https://jsonplaceholder.typicode.com/posts");

  try {
    final resp = await http.get(url);
    if (resp.statusCode == 200) {
      List<dynamic> data = jsonDecode(resp.body);
      for (var item in data.take(5)) { // hardcoded 5
        print("Title: ${item['title']}");
      }
    } else {
      print("Error: ${resp.statusCode}");
    }
  } catch (e) {
    print("Error: $e");
  }

CLI args:

void main(List<String> args) async {
  if (args.isEmpty || args.length > 1) {
    print("Please provide a single argument.");
    print("Please provide posts count.");
    print("Usage: dart run bin/main.dart 4");
    return;
  }

  // ...
  final postsCount = int.tryParse(args[0]);
  print("You wanted $postsCount posts.");

  if (postsCount == null) {
    print("Please provide a valid number.");
    return;
  }

  // ...
  // FETCH POSTS

  for (var item in data.take(postsCount)) { // PRINT POSTS
        print("Title: ${item['title']}");
      }
}

About

Dart CLI project for displaying GitHub user activity

Topics

dart-apidart-clidart-cli-sampledart-consolegithubgithub-apigithub-api-dart

Resources

Readme
Activity

Stars

1 star

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.