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 - stevenosse/sequence: Open source music recognition application using https://audd.io 's API

BranchesTags
Open more actions menu

Latest commit

 

History

31 Commits
31 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
android
android
 
 
assets
assets
 
 
ios
ios
 
 
lib
lib
 
 
test
test
 
 
test_resources
test_resources
 
 
z_repo-resources
z_repo-resources
 
 
.gitignore
.gitignore
 
 
.metadata
.metadata
 
 
README.md
README.md
 
 
analysis_options.yaml
analysis_options.yaml
 
 
demo.gif
demo.gif
 
 
pubspec.lock
pubspec.lock
 
 
pubspec.yaml
pubspec.yaml
 
 

Repository files navigation

Sequence

Music Recognition app using Audd's Music recognition API

ci ci follow on Twitter

Content

  • 🚧 Getting Started 🚧
    • App Demo:
    • Running the app
      • Step 1
      • Step 2
      • Step 3
  • Architecture and Folder Structure
    • Data layer
      • Api Controllers
      • Repositories
    • Business logic layer
      • Services
      • Cubits/BLoCs
    • Presentation layer
  • Folder structure
  • Testing
  • Tools

🚧 Getting Started 🚧

šŸ—ļø Construction is underway, there may be a lot of elements missing in this README

App Demo:

Application Demo

Running the app

Couple steps are required to run this app on your local machine.

First, get an API Token from Audd by following this link.

Step 1

An API Token is required to run the app. This API Token is retrieved from environment variables read throught dart define. You'll need to provide is as well as the api base url:

$ flutter run --dart-define apiBaseUrl=https://api.audd.io --dart-define AUDD_API_TOKEN=<YOUR_API_TOKEN>

Step 2

Install dependencies:

$ flutter pub get

Step 3

Run code generation:

$ flutter pub run build_runner build --delete-conflicting-outputs

Architecture and Folder Structure

This project uses the BLoC Architecture. Learn more on https://bloclibrary.dev

Data layer

This layer is responsible of manipulating data from one or more sources

Data layer

Api Controllers

Are responsible for API calls. They all extend the BaseApiController class. Are not responsible for data processing.

class UserApiController extends BaseApiController {
  UserApiController({required super.dio});

  Future<Response<Json>> recognize({
    required Request request,
    CancelToken? cancelToken,
  }) async {
    try {
      final Response<Json> response = await dio.post('/endpoint', data: await request.toJson());

      return response;
    } on DioError catch (_) {
      rethrow;
    }
  }
}

Repositories

They can aggregate multiple data sources (eg. Multiple API Controllers). They all extend be BaseRepository class which contains the runApiCall method that has necessary logi cfor errors handling.

class TestRepository extends BaseRepository {
  final MyApiController _myApiController;
  final MySecondApiController _mySecondApiController;

  TestRepository({
    MyApiController? myApiController,
    MySecondApiController? mySecondApiController,
  }) : _myApiController = myApiController ?? locator<MyApiController>(),
      _mySecondApiController = mySecondApiController ?? locator<MySecondApiController>();

  Future<NetworkResponse<TestResponse, CustomHttpException>> test(MyRequest request) async {
    return runApiCall<TestResponse>(
      call: () async {
        final response = await _myApiController.test(request: request);

        return NetworkResponse.success(TestResponse.fromJson(response.data!));
      },
    );
  }
}

Business logic layer

The business logic layer's responsibility is to respond to input from the presentation layer with new states. This layer can depend on one or more repositories to retrieve data needed to build up the application state.

From https://bloclibrary.dev

This layer hosts our blocks, cubits and services.

Services

They are used to store any logic that's not related to a UI State

Cubits/BLoCs

They are used to store any logic that can result to a UI State change

Presentation layer

This layer is the one the user interacts with. It renders itself base on one or more BLoC/Cubit's state

Folder structure

Here's how our folder structure look like:

lib/
ā”œā”€ā”€ generated/
└── src/
ā”œā”€ā”€ core/
│ ā”œā”€ā”€ i18n/
│ ā”œā”€ā”€ routing/
│ ā”œā”€ā”€ theme/
│ ā”œā”€ā”€ app_initialiser.dart
│ ā”œā”€ā”€ application.dart
│ └── environment.dart
ā”œā”€ā”€ datasource/
│ ā”œā”€ā”€ http/
│ ā”œā”€ā”€ models/
│ └── repositories/
│ └── base_repository.dart
ā”œā”€ā”€ features/
│ ā”œā”€ā”€ music_recognition/
│ │ ā”œā”€ā”€ enums/
│ │ ā”œā”€ā”€ exceptions/
│ │ ā”œā”€ā”€ logic/
│ │ ā”œā”€ā”€ repositories/
│ │ ā”œā”€ā”€ services/
│ │ └── ui/
│ └── music_details/
└── main.dart

Testing

This repo uses couple of testing libs :

  • bloc_test: A Dart package that makes testing blocs and cubits easy
  • mocktail: A Dart mock library which simplifies mocking with null safety support and no manual mocks or code generation.
  • http_mock_adapter: A simple to use mocking package for Dio intended to be used in tests. It provides various types and methods to declaratively mock request-response communication.

Usage examples are available in the test dir.

Tools

  • fvm: used for flutter version management
  • flutter_gen: Used to generated assets

About

Open source music recognition application using https://audd.io 's API

Topics

blocdartdartlangdioflutterflutter-appsflutter-demoflutter-examplesopen-sourceshazam-clonetesting

Resources

Readme
Activity

Stars

15 stars

Watchers

2 watching

Forks

4 forks
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.