Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

last_fm

codecov

a simple app to demonstrate a testable, maintainable, and scalable architecture for flutter. flutter_bloc, hive, and
rest api are some of the tech stacks used in this project.


screenshots ��

albums artist
top_albums album_detail

getting started

for the app to work, you need to provide your own last.fm api key by issuing here.

once you get your api key, you can run or build the app by using the following command:

# run
$ flutter run --dart-define=api_key=put_your_api_key_here

# build
$ flutter build --dart-define=api_key=put_your_api_key_here

running tests

to run all unit and widget tests use the following command:

$ flutter test --coverage --test-randomize-ordering-seed random

to remove generated files from the coverage report, use the following command:

# install remove_from_coverage package 
$ pub global activate remove_from_coverage

# remove `.g.dart` and `.config.dart` files from the coverage report
$ pub global run remove_from_coverage:remove_from_coverage -f coverage/lcov.info -r '.g.dart', '.config.dart'

to view the generated coverage report you can use lcov.

# generate coverage report
$ genhtml coverage/lcov.info -o coverage/

# open coverage report
$ open coverage/index.html

working with translations

this project relies on flutter_localizations and follows
the official internationalization guide for flutter.

adding strings

  1. to add a new localized string, open the app_en.arb file at lib/config/l10n/arb/app_en.arb.
{
  "@@locale": "en",
  "appname": "lastfm",
  "@appname": {
    "description": "the application name"
  }
}
  1. then add a new key/value and description
{
  "@@locale": "en",
  "appname": "lastfm",
  "@appname": {
    "description": "the application name"
  },
  "albums": "albums",
  "@albums": {
    "description": "text shown in the appbar of albumsscreen"
  },
}
  1. use the new string
import 'package:some_app/l10n/l10n.dart';

@override
widget build(buildcontext context) {
  final l10n = context.l10n;
  return text(l10n.albums);
}

adding supported locales

update the cfbundlelocalizations array in the info.plist at ios/runner/info.plist to include the new locale.

    ...

<key>cfbundlelocalizations</key>
<array>
<string>en</string>
<string>am</string>
</array>

        ...

adding translations

  1. for each supported locale, add a new arb file in lib/config/l10n/arb.
├── l10n
│   ├── arb
│   │   ├── app_en.arb
│   │   └── app_am.arb
  1. add the translated strings to each .arb file:

app_en.arb

{
  "@@locale": "en",
  "appname": "lastfm",
  "@appname": {
    "description": "the application name"
  },
}

app_am.arb

{
  "@@locale": "am",
  "appname": "የመጨረሻ ኤፍ ኤም",
  "@appname": {
    "description": "የመተግበሪያ ስም"
  },
}

Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD


Download this source code for
5 USD

Comments are closed.