intl_toolbox 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 57

intl_toolbox #

A useful toolbox for intl_translation package

Dependencies #

  • Add intl_translation dependency to your application

Example #

An example is available here

Getting Started #

This project is a toolbox for intl_translation package

To generate translation files :

flutter pub pub run intl_toolbox:generate

To add new strings edit lib/res/string_resources.dart file and call generate again

To add a new locale and create associated arb file :

flutter pub pub run intl_toolbox:add_locale en_US

You can find arb files in lib/generated/l10n/arb/ intl_messages.arb is the default arb file intl_LOCALE_CODE.arb represent your translations.

Don't forget to call the generate command after arb files edition

[0.1.0] - 30/12/19. #

  • Initial release.

[0.1.1] - 30/12/19. #

  • Update package description.
  • Remove unused variables.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:int_toolbox_example/generated/localizations/localizations_util.dart';
import 'package:int_toolbox_example/res/string_resources.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: MyHomePage(),
      localizationsDelegates: StringResources
          .localizationsDelegate, // Set the localizationsDelegate
      supportedLocales: StringResources
          .supportedLocales, // Set the supportedLocales (Editable in lib/res/string_resources.dart)
      locale: Locale('en', 'US'), // Selected locale
    );
  }
}

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key}) : super(key: key);

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(S.of(context).title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(
              S.of(context).text,
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.display1,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: S.of(context).tooltip,
        child: Icon(Icons.add),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  intl_toolbox: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:intl_toolbox/intl_toolbox.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
15
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
57
Learn more about scoring.

We analyzed this package on Apr 4, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health issues and suggestions

Document public APIs. (-1 points)

12 out of 12 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
intl_translation ^0.17.7 0.17.9
path ^1.6.4 1.6.4
Transitive dependencies
_fe_analyzer_shared 2.0.0
analyzer 0.39.5
args 1.6.0
async 2.4.1
charcode 1.1.3
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
dart_style 1.3.3
glob 1.2.0
html 0.14.0+3
intl 0.16.1
js 0.6.1+1
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.9.3
pedantic 1.9.0
petitparser 2.4.0 3.0.2
pub_semver 1.4.4
sky_engine 0.0.99
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
vector_math 2.0.8
watcher 0.9.7+14
yaml 2.2.0
Dev dependencies
flutter_test