adhara 1.0.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 71

adhara #

Base framework for Flutter Apps with intense networking and data interactivity. Adhara provides a seamless offline experience with much ease.

What adhara brings to the plate?

  1. Easy SQLite management - ORM, using DataInterfaces
  2. Easy network setup with the help of network middlewares
  3. Manage data using Data Beans in a well structured format. No more worries about runtime errors or key changes in JSON.
  4. Event Handlers: Listen to events across the widgets. An event can be triggered in one dart file and can be listened in any of stateful widgets*
  5. Internationalization - Manual i18N based on selected language.
  6. Easy routing: Simplified Regex based URL routing like in a web application
  7. Easy Sentry Logger in production with one DSN configuration
  8. Properties file parser, JSON file reader, running modes and many more...

*stateful widget is overridden by adhara and is called AdharaStatefulWidget, and has a state named AdharaState

Getting Started #

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

Report your issues: https://github.com/infitio/flutter-adhara/issues

Using adhara commands #

IN DEV

flutter packages pub global activate --source path ./

IN INSTALLED

flutter packages pub global activate adhara

Make sure pub cache is added to PATH

flutter packages pub global run adhara:adhara

flutter packages pub global run adhara:adhara setup_app

flutter packages pub global run adhara:adhara create_module --name <YourModuleName>

[1.0.3] - 02nd December, 2019

  • Fix i18n resources r.getString(...) method

[1.0.2] - 02nd December, 2019

  • introducing resource based app and module utils. Configure in module.dart the utils getter to be able to load r.utils. Same applies for app.dart and ar.utils
  • introducing baseRoute. Get baseRoute by r.module.baseRoute
  • new low level method in AppResources to create module specific encapsulated widgets that can use resources ar.createResourceEncapsulatedModuleWidget(String moduleName, Widget widget)

[1.0.0] - 02nd December, 2019

  • Adhara redesigned
  • Module based applications
  • Plug and play modules
  • Chopper support for network interaction
  • [WIP] Auto generating database models from built values. Inspired from Djnago

[0.2.1] - 10th January, 2019

  • default for string resources can be provided with the new signature... getString(key, {String defaultValue, bool suppressErrors: false})

if suppressErrors is set to true, errors related to key not found will not be thrown even in strict mode

[0.1.69] - 7th December, 2018

  • Introducing setData(key,value) and getData(key) in Adhara event
  • Event emitters can await for handler execution and get handler return value by using event.getData(tag)

[0.1.66] - 24th November, 2018

  • loading indicator update

[0.1.63] - 22nd November, 2018

  • Bug fixes for offlineProvider response type (changed Map to dynamic)
  • Asset file loader is now released of restrictions to read JSONArray from .json files. return type is made dynamic from Map

[0.1.62] - 22nd November, 2018

  • Data mock can be stored in assets/data/

    For example:

      Network Provider(Online) calls GET '/api/v1/items',
      Using Offline provider one can mock the data by creating '/assets/data/api-v1-items-get.json'
      (or)
      Network Provider(Online) calls DELETE '/api/v1/items/1',
      Using Offline provider one can mock the data by creating '/assets/data/api-v1-items-1-delete.json'
      (or)
      Network Provider(Online) calls PUT '/api/v1/items/?status=available',
      Using Offline provider one can mock the data by creating '/api/v1/items--status=available'
    

    Note that / and ? will eb replaced by -. This behavior can be overridden by overriding OfflineProvider and configuring the same on Config class

[0.1.61] - 22nd November, 2018

  • expanding network provider to an abstract classes data provider and 2 implementation classes network and offline

  • Offline provider can be helpful for data mocking in development Data mock can be stored in assets/data/

    For example:

    Network Provider(Online) calls GET '/api/v1/items',
    Using Offline provider one can mock the data by creating '/assets/data/api/v1/items/get.json'
    (or)
    Network Provider(Online) calls DELETE '/api/v1/items/1',
    Using Offline provider one can mock the data by creating '/assets/data/api/v1/items/1/delete.json'
    

    Note that method name must be lowercase Offline provider greatly helps in integrated testing with data

[0.1.58] - 21st November, 2018

  • Introducing few commonly used widgets: Fetching, NoData, Paginator, PullToRefresh

[0.1.57] - 21st November, 2018

  • Introducing few commonly used widgets: Fetching, NoData, Paginator, PullToRefresh

[0.1.55] - 14th November, 2018

  • AdharaStatefulWidget~isFirstLoadComplete was returning wrong status, issue fixed.

[0.1.54] - 14th November, 2018

  • code optimization

[0.1.53] - 14th November, 2018

  • removing fragile socket.io dependency thereby removing support for webSockets.
  • new getter fromFile in Config. Using this configuration json variables can be accessed

[0.1.52] - 12th November, 2018

  • Bug Fix for filter and exclude combinations in dataInterface.query

[0.1.51] - 9th November, 2018

  • Optimize setData in KeyValueStorageProvider

[0.1.50] - 6th November, 2018

  • isFirstLoadComplete getter to know if the widget has completed loading for the very first time in app lifecycle

[0.1.48] - 14th October, 2018

  • registerSocketEvents removed. added get eventHandlers => {}; this should return event-handler map.
  • Example:
get eventHandlers => {
    'app:new-notification': this.refreshNotificationIcon
};

[0.1.45] - 14th October, 2018

  • registerSocketEvents signature changed to Future registerSocketEvents(SocketIO socket);

[0.1.44] - 14th October, 2018.

  • Introducing socket connections using socket.io
  • Override registerSocketEvents from NetworkProvider and use instance level socket field to listen to events
  • Usage
      //example
      Future registerSocketEvents() async {
          await socket.on('message', (greeting) {
            print('Hello, $greeting');
          });
          await socket.emit('init', [
            {'Hello': 'world!'},
          ]);
        }
    

[0.1.43] - 14th October, 2018.

  • Optimized/Enhanced event handler. Introducing Event object

[0.1.42] - 14th October, 2018.

  • Introducing event handler. Register and trigger events across widgets.
  • Usage: inside State class extending AdharaState,
      on("eventName", handlerFn);     //to register
      off("eventName")                //to de-register
      trigger("someOtherEvent")       //to trigger event across all mounted stateful widgets
    

[0.1.41] - 13th October, 2018.

  • Removed HTTPStorageProvider support. Use KeyValue storage provider if required, or create a HTTPStorage provider extending KeyValueStorage.

[0.1.40] - 13th October, 2018.

  • Removed storage provider schema configurations. Only fields can be configured now using storage_classes

[0.1.39] - 13th October, 2018.

  • Dart 2.0 Support.

[0.1.33] - 08th October, 2018.

  • KeyValueStorageProvider - value was Unique, now changed to non unique

[0.1.32] - 28th September, 2018.

  • printing preload errors

[0.1.31] - 28th September, 2018.

  • Enforcing usage of

[0.1.30] - 28th September, 2018.

  • Config can now configure config configFile field which returns a file from assets - config file. this eases up development files...

[0.1.25] - 28th September, 2018.

  • flutter's presky setState error in development for "setState called after dispose" is suppressed by performing a check in adhara's stateful_widget

[0.1.24] - 27th September, 2018.

  • Enhanced logging for network calls

[0.1.22] - 26th September, 2018.

  • Bug Fix for constraints in Schema Columns

[0.1.21] - 24th September, 2018.

  • Enhancements in bean.dart

[0.1.19] - 21th September, 2018.

  • Bug Fixes in 0.1.0

[0.1.0] - 13th September, 2018.

  • Storage Field classes introduced. table schema can now be declared easily with introduced classes by making field types mandatory
  • Storage Field classes will support storing boolean/json fields - serialization and deserialization will be taken care by these classes

[0.0.45] - 2nd September, 2018.

  • Adding examples

[0.0.44] - 2nd September, 2018.

  • Adding shared preferences in Resources. User r.preferences to access shared_preferences API's

[0.0.42] - 29th August, 2018.

  • Reverting to previous

[0.0.41] - 29th August, 2018.

  • Upgrade all dependencies to latest

[0.0.39] - 29th August, 2018.

  • Resources made available in DataInterface by public field r.

[0.0.38] - 19th August, 2018.

  • Router's getRoute function's argument urlPatterns now accepts kwargs, ex: {"pattern": "^posts/{{postId}}([0-9]+)/edit\$", "router": NewPost.router, "kwargs": {"edit": true}},

[0.0.36] - 17th August, 2018.

  • Storage provider create table error handled for IOS

[0.0.35] - 12th August, 2018.

  • Sentry ignore strings introduced. List<String> get sentryIgnoreStrings in Config

[0.0.34] - 11th August, 2018.

  • Adding sentry. use Config.sentryDSN to configure sentry data source name

[0.0.32] - 7th August, 2018.

  • NetworkProvider enhanced. Interceptors introduced.

[0.0.30] - 4th August, 2018.

  • single instance database referred from resources. It is expected to be auto closed on app closing...

[0.0.28] - 1st August, 2018.

  • loadLanguage introduced. Can call this to load new languages whenever required

[0.0.28] - 29th July, 2018.

  • clearResources introduced. This can be called on logout from the application.
  • clearResources by default clear's AppState and calls DataInterface's clearDataStores method.
  • dataStores getter introduced in DataInterface. This must return all data stores whose creation and truncation will be handled with easy utils.

[0.0.27] - 19th July, 2018.

  • Mode utilities added

[0.0.25] - 19th July, 2018.

  • Introducing tag for AdharaState to manage state related unique variables

[0.0.22] - 19th July, 2018.

  • Dart 2 support

[0.0.22] - 19th July, 2018.

  • All calling functions enhanced with same signature

[0.0.21] - 19th July, 2018.

  • StorageProvider methods relating to get list now accepts all arguments supported by sqflite

[0.0.20] - 19th July, 2018.

  • StorageProvider delete operation Signature changes

[0.0.18] - 19th July, 2018.

  • Introducing Batch Udpate.

[0.0.16] - 18th July, 2018.

  • Created time and Updated time for all beans and storage's.

[0.0.13] - 18th July, 2018.

  • Introducing AdharaStatelessWidget. Use buildWithResources(BuildContext context, Resources r) to access resources.

[0.0.12] - 15th July, 2018.

  • Network provider failure responses now throw error

[0.0.10] - 15th July, 2018.

  • App state scope get and set method names changed to getValue setValue.
  • default value made optional for getValue

[0.0.6] - 15th July, 2018.

  • providing r as a getter in adhara stateful widget

[0.0.5] - 15th July, 2018.

  • Introducing remove in KeyValueStorageProvider

[0.0.4] - 15th July, 2018.

  • Adding option for custom data interface in config.dart

[0.0.2] - 15th July, 2018.

  • Adding URL launcher as a single function call which abstracts checks for canLaunch

[0.0.1] - 15th July, 2018.

  • AdharaStatefulWidget and AdharaSState to manage lifecycle events for data
  • Resource Handling for languages
  • Router to handle URL's by path
  • SQFLite integrated for database interactions
  • Bean (~ POJO classes from Java) based storage handlers
  • KeyValue stores in database
  • http storage for URL based storage

example/README.md

Example #

Refer to example in git root ../../

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate adhara

2. Use it

The package has the following executables:


$ adhara

Use this package as a library

1. Depend on it

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


dependencies:
  adhara: ^1.0.3

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:adhara/adhara.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
52
Health:
Code health derived from static analysis. [more]
98
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
71
Learn more about scoring.

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

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5

Health suggestions

Fix lib/resources/ri.dart. (-1 points)

Analysis of lib/resources/ri.dart reported 2 hints:

line 27 col 17: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

line 52 col 17: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..

Fix lib/app.dart. (-0.50 points)

Analysis of lib/app.dart reported 1 hint:

line 4 col 8: Unused import: 'package:adhara/resources/ri.dart'.

Fix lib/datainterface/models/migrator.dart. (-0.50 points)

Analysis of lib/datainterface/models/migrator.dart reported 1 hint:

line 3 col 8: Don't import implementation files from another package.

Fix additional 10 files with analysis or formatting issues. (-0.50 points)

Additional issues in the following files:

  • lib/datainterface/storage/storage_provider.dart (1 hint)
  • lib/configurator.dart (Run flutter format to format lib/configurator.dart.)
  • lib/foundation.dart (Run flutter format to format lib/foundation.dart.)
  • lib/module.dart (Run flutter format to format lib/module.dart.)
  • lib/resources/_r.dart (Run flutter format to format lib/resources/_r.dart.)
  • lib/resources/ar.dart (Run flutter format to format lib/resources/ar.dart.)
  • lib/resources/r.dart (Run flutter format to format lib/resources/r.dart.)
  • lib/resources/u.dart (Run flutter format to format lib/resources/u.dart.)
  • lib/router.dart (Run flutter format to format lib/router.dart.)
  • lib/widgets/stateful_widget.dart (Run flutter format to format lib/widgets/stateful_widget.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-20 points)

The version constraint in pubspec.yaml does not support the latest published versions for 2 dependencies (built_value, sentry).

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.2 <3.0.0
args ^1.5.2 1.5.2
built_value ^6.7.0 6.8.2 7.0.8
chopper ^3.0.0 3.0.1+1
flutter 0.0.0
http ^0.12.0+2 0.12.0+4
path ^1.6.4 1.6.4
path_provider ^1.4.2 1.5.1
sentry ^2.3.1 2.3.1 3.0.0+1
shared_preferences ^0.5.4+5 0.5.6
sqflite ^1.1.7+2 1.2.0
url_launcher ^5.2.5 5.4.1
yaml ^2.2.0 2.2.0
Transitive dependencies
analyzer 0.38.5 0.39.4
analyzer_plugin 0.2.1
async 2.4.0
build 1.2.2
build_config 0.4.1+1
built_collection 4.3.2
built_value_generator 6.8.2 7.0.8
charcode 1.1.2
checked_yaml 1.0.2
collection 1.14.11 1.14.12
convert 2.1.1
crypto 2.1.4
csslib 0.16.1
dart_style 1.3.3
fixnum 0.10.11
flutter_web_plugins 0.0.0
front_end 0.1.27 0.1.29
glob 1.2.0
html 0.14.0+3
http_parser 3.1.3
js 0.6.1+1
json_annotation 3.0.1
kernel 0.3.27 0.3.29
logging 0.11.4
matcher 0.12.6
meta 1.1.8
node_interop 1.0.3
node_io 1.0.1+2
package_config 1.1.0
pedantic 1.9.0
platform 2.2.1
plugin_platform_interface 1.0.1
pub_semver 1.4.2
pubspec_parse 0.1.5
quiver 2.1.2+1
shared_preferences_macos 0.0.1+4
shared_preferences_platform_interface 1.0.1
shared_preferences_web 0.1.2+3
sky_engine 0.0.99
source_gen 0.9.4+6 0.9.4+7
source_span 1.6.0
stack_trace 1.9.3
string_scanner 1.0.5
synchronized 2.1.1
term_glyph 1.1.0
typed_data 1.1.6
url_launcher_macos 0.0.1+2
url_launcher_platform_interface 1.0.5
url_launcher_web 0.1.0+2
usage 3.4.1
vector_math 2.0.8
watcher 0.9.7+13