{"id":22050140,"url":"https://github.com/icapps/flutter-icapps-architecture","last_synced_at":"2025-05-08T23:10:51.192Z","repository":{"id":40371082,"uuid":"353279339","full_name":"icapps/flutter-icapps-architecture","owner":"icapps","description":"Architecture components used in icapps flutter projects","archived":false,"fork":false,"pushed_at":"2024-05-17T15:16:24.000Z","size":598,"stargazers_count":8,"open_issues_count":3,"forks_count":2,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-05-17T16:34:00.951Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/icapps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-31T08:16:42.000Z","updated_at":"2024-05-27T12:35:25.597Z","dependencies_parsed_at":"2023-09-26T18:19:08.869Z","dependency_job_id":"e5fd68ee-ae6b-4ce5-9f89-36cddf5fd232","html_url":"https://github.com/icapps/flutter-icapps-architecture","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-icapps-architecture","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-icapps-architecture/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-icapps-architecture/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icapps%2Fflutter-icapps-architecture/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icapps","download_url":"https://codeload.github.com/icapps/flutter-icapps-architecture/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160776,"owners_count":21863630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-30T14:18:00.410Z","updated_at":"2025-05-08T23:10:51.173Z","avatar_url":"https://github.com/icapps.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flutter icapps architecture\nArchitecture components used in icapps flutter projects\n\n[![pub package](https://img.shields.io/pub/v/icapps_architecture.svg)](https://pub.dartlang.org/packages/icapps_architecture)\n[![Build Status](https://app.travis-ci.com/icapps/flutter-icapps-architecture.svg?branch=main)](https://app.travis-ci.com/icapps/flutter-icapps-architecture)\n[![Coverage Status](https://coveralls.io/repos/github/icapps/flutter-icapps-architecture/badge.svg?branch=main)](https://coveralls.io/github/icapps/flutter-icapps-architecture?branch=main)\n\n### Custom Error handling\n#### Localized error\nThis error can be used to map a localization key/localization to an Exception. So when the exception is thrown you don't have to do an extra mapping to get the correct text.\n\n#### Network Error\nA NetworkError is used simplify the DioErrors. A NetworkError is also a LocalizedError so it is easy to get the correct localization/localizationKey\n\n### Extensions\n\n#### Context\n- `bool isAndroidTheme` (Returns true if the current theme is targeting the android platform)\n- `bool isIOSTheme` (Returns true if the current theme is targeting the ios platform)\n- `bool isTablet` (Returns true if the device indicates it is a tablet.)\n- `bool isLandscape` (Returns true if the device indicates it is in landscape mode.)\n\n#### MediaQueryData\n- `bool isTablet` (Returns true if the device indicates it is a tablet.)\n- `bool isLandscap` (Returns true if the device indicates it is in landscape mode.)\n\n#### Iterable\u003cT\u003e\n- `int count(bool Function(T) where)` (Counts all elements for which [where] returns true)\n- `E sum\u003cE extends num\u003e(E Function(T) valueProducer)` (Sums the result of [valueProvider] for each item)\n- `T? find(bool Function(T) where)` (Finds the first item that matches [where], if no such item could be found)\n- `bool all(bool Function(T) where)` (Returns `true` if every item matches [where])\n- `Map\u003cS, T\u003e associateBy\u003cS\u003e(S Function(T) key)` (Create a map by mapping every element using [key]. Duplicate values discarded)\n- `Tuple2\u003cList\u003cT\u003e, List\u003cT\u003e\u003e split(bool Function(T) on)` (Splits the elements according to [on]. Items for which [on] is true will be stored in [Tuple2.item1], other items in [Tuple2.item2])\n- `Iterable\u003cR\u003e mapIndexed\u003cR\u003e(R Function(int, T) mapper)` (Same as [Iterable.map] except that the [mapper] function also receives the index of the item being mapped)\n- `void forEachIndexed(Function(int, T) f)` (Same as [Iterable.foreach] except that the [f] function also receives the index of the item)\n- `Iterable\u003cK\u003e mapNotNull\u003cK\u003e(K? Function(T) f)` (Same as [Iterable.map] except that the [f] function can return `null` and the resulting iterable will not contain `null` values)\n\n##### Iterable\u003cIterable\u003cT\u003e\u003e\n- `List\u003cT\u003e flatten()` (Flattens the list of lists to a single flat list of items)\n\n#### List\u003cT\u003e\n- `void replaceAll(Iterable\u003cT\u003e newData)` (Replaces all data in the list with [newData])\n- `void replaceWhere(bool Function(T) where, T newData, {int? count})` (Replaces all items that matches where with [newData])\n- `void sortBy\u003cR\u003e(Comparable\u003cR\u003e? by(T item), {bool ascending = true})` (Sorts the list based on the comparable returned by [by]. By default the sorting is [ascending])\n- `void sortBy2\u003cR, V\u003e( Comparable\u003cR\u003e? by(T item), Comparable\u003cV\u003e? by2(T item), {bool ascending = true})` (Sorts the list by comparing first comparing using [by] and if the items are equal, by comparing them using [by2]. By default the sorting is [ascending])\n\n#### Map\u003cK?,V\u003e\n- `Map\u003cK, V\u003e removeNullKeys()` (Removes all null keys from the map)\n\n#### Map\u003cK,V?\u003e\n- `Map\u003cK, V\u003e removeNullValues()` (Removes all null values from the map)\n\n#### T?\n- `R? let\u003cR\u003e(R? Function(T) lambda)` (Execute the given lambda and return a result)\n\n#### String?\n- `bool isNullOrEmpty` (Will return if the string is null or empty)\n- `bool isNotNullOrEmpty` (Will return if the string is not null and not empty)\n\n### Interceptor\n#### CombiningSmartInterceptor\nBase class for simple [Dio] interceptors to be used in conjunction with CombiningSmartInterceptor\nUpon returning an instance of [DioError] from [onRequest] or [onResponse], the error interceptors will NOT be called\n\n### ChangeNotifierEx\nExtended version of the foundation's [ChangeNotifier].\nHas helper methods to determine if it has been disposed ([disposed]) and convenience methods to register listeners that will be cleaned up when the change notifier is disposed [registerDispose()] and [registerDisposeStream()]\n\n### Routes\n#### FadeInRoute\nPage route that fades in the child page\n\n### Theme\n#### BaseThemeData\nHolder class for the theme base. Fills in basic shared properties\n- `baseTheme` (Gets the base theme to use to build new themes on)\n- `PageTransitionsBuilder getCorrectPageTransitionBuilder(OsInfo info)` (Builds the correct page transition based on the current OS)\n\n### Connectivity\n#### ConnectivityHelper\nHelper to determine if a device has connectivity\n- `Future\u003cbool\u003e hasConnection()` (Returns true if the device is connected to an IP network)\n- `Stream\u003cbool\u003e monitorConnection()` (Returns a stream that monitors the connectivity state of the device)\n\n### Environment global variables\n- `bool isInTest` (Returns true if the code is currently being execute by unit tests)\n- `bool isInRelease` (Returns true if the current code is executing in release mode)\n- `bool isInDebug` (Returns true if the current code is executing in debug mode)\n- `bool isInProfile` (Returns true if the current code is executing in profile mode)\n\n### OsInfo\n- `int androidSdk` (The android sdk version int (if the app is running native). Eg: 21)\n- `double iosVersion` (The ios major and minor version (if the app is running native). Eg: 14.4)\n- `bool isWeb` (Indicates that this is a non-native application)\n- `bool isAndroid` (Returns true if the app is running natively on android)\n- `bool isIOS` (Returns true if the app is running natively on ios)\n- `bool isAtLeastAndroid10` (Returns true if the app is running natively on android 10 and higher)\n- `bool isAtLeastPie` (Returns true if the app is running natively on android P and higher)\n- `bool isIOS13OrAbove` (Returns true if the app is running natively on at least ios 13)\n- `Future\u003cvoid\u003e init` (Initializes the os info)\n- `bool isDeviceAndroid` (Platform.isAndroid)\n- `bool isDeviceIOS` (Platform.isIOS)\n\n### ComputePool\nA pool of isolate workers that will handle passed work.\nUsing a compute pool will greatly reduce the dart isolate startup overhead\n- `ComputePool.createWith({int workersCount = 2})` (Create a new compute pool with the requested number of worker isolates)\n- `void shutdown()` (Shuts down the compute pool. Submitting new work will result in an error future being returned)\n- `ComputePool.createWith({int workersCount = 2})` (Submit a task to be executed on an isolate in this pool)\n\n### FutureHelpers\nWaits for n futures and returns a future containing a [TupleN] with the results for n futures\n- `await2`\n- `await3`\n- `await4`\n- `await5`\n- `await6`\n- `await7`\n\n### Logger\nSend logs, via the `staticLogger` or `logger`\nExtra configuration can be added using `LoggingFactory.configure`\nYou can specific when you you want to actually print something using the `Level`\n- `void debug(String message, {dynamic error, StackTrace? trace})`\n- `void info(String message, {dynamic error, StackTrace? trace})`\n- `void warning(String message, {dynamic error, StackTrace? trace})`\n- `void error(String message, {dynamic error, StackTrace? trace})`\n\n### SharedPreferenceStorage\nUtility class to facilitate storing shared preferences\n- `Future\u003cvoid\u003e saveString({required String key, required String value})` (Saves the given string [value] to the storage with [key])\n- `Future\u003cvoid\u003e saveBoolean({required String key, required bool value})` (Saves the given boolean [value] to the storage with [key])\n- `Future\u003cvoid\u003e saveInt({required String key, required int value})` (Saves the given integer [value] to the storage with [key])\n- `Future\u003cvoid\u003e saveDouble({required String key, required double value})` (Saves the given double [value] to the storage with [key])\n- `String? getString(String key)` (Retrieves the stored string value for [key]/ Returns null if the value is not found)\n- `bool? getBoolean(String key)` (Retrieves the stored boolean value for [key]. Returns null if the value is not found)\n- `int? getInt(String key)` (Retrieves the stored integer value for [key]. Returns null if the value is not found)\n- `double? getDouble(String key)` (Retrieves the stored double value for [key]. Returns null if the value is not found)\n- `Future\u003cvoid\u003e deleteKey(String key)` (Deletes the value stored for [key])\n- `bool containsKey(String key)` (Returns true if there is a value for [key])\n- `Future\u003cvoid\u003e reload()` (Fetches the latest values from the host platform. Use this method to observe modifications that were made in native code (without using the plugin) or by another process while the app is running.)\n\n### Restorable state\n#### Bundle\nWrapper for storing generic values based on keys. The contained values are all serializable using platform channels\n- `Bundle.from(Object data)` (Creates a bundle from the provided map. The map is assumed to be of type: `Map\u003cObject?, Object?\u003e`. See: [asFlatStructure])\n- `void putBoolean(String key, bool? value)` (Saves the given value to the map for the given key. If the value is null, the previous mapping is removed (if any))\n- `void putInt(String key, int? value)` (Saves the given value to the map for the given key. If the value is null, the previous mapping is removed (if any))\n- `void putString(String key, String? value)` (Saves the given value to the map for the given key. If the value is null, the previous mapping is removed (if any))\n- `void putBundle(String key, Bundle? bundle)` (Saves the given value to the map for the given key. If the value is null, the previous mapping is removed (if any))\n- `void putDouble(String key, double? value)` (Saves the given value to the map for the given key. If the value is null, the previous mapping is removed (if any))\n- `void putStringList(String key, List\u003cString\u003e? values)` (Saves the given value to the map for the given key. If the value is null, the previous mapping is removed (if any))\n- `void remove(String key)` (Removes the mapping for the given key (if any))\n- `bool getBoolean(String key)` (Force-gets the value for the given key, throws if null or wrong type)\n- `bool hasKey(String key)` (Checks if the bundle contains a value with the given key)\n- `int getInt(String key)` (Force-gets the value for the given key, throws if null or wrong type)\n- `String getString(String key)` (Force-gets the value for the given key, throws if null or wrong type)\n- `double getDouble(String key)` (Force-gets the value for the given key, throws if null or wrong type)\n- `List\u003cString\u003e getStringList(String key)` (Force-gets the value for the given key, throws if null or wrong type)\n- `Bundle getBundle(String key)` (Force-gets the value for the given key, throws if null or wrong type)\n- `bool? optBoolean(String key)` (Gets the value for the given key, returns null if null or wrong type)\n- `int? optInt(String key)` (Gets the value for the given key, returns null if null or wrong type)\n- `String? optString(String key)` (Gets the value for the given key, returns null if null or wrong type)\n- `double? optDouble(String key)` (Gets the value for the given key, returns null if null or wrong type)\n- `Bundle? optBundle(String key)` (Gets the value for the given key, returns null if null or wrong type)\n- `List\u003cString\u003e? optStringList(String key)` (Gets the value for the given key, returns null if null or wrong type)\n- `Map\u003cObject?, Object?\u003e asFlatStructure() =\u003e _internalMap.map((key, value)` (Serializes the bundle to a flat structure that is used by the restoration framework. See [RestorationMixin])\n\n### Restorable\nBase class for restorable change view models\n- `void restoreState(Bundle? data)` (Called when the system is restoring or creating a new instance. If the passed bundle is null, it is assumed to be a clean restoration without previous state)\n- `void saveState(Bundle target)` (Called when the system needs to prepare data for later restoration. You should save all relevant required data to restore from later. Keep in mind that the system has only a limited amount of space reserved for this data: avoid storing large objects.)\n\n#### RestorableViewModelHolder\nHolder class for restorable view models, use with the flutter restoration\nProvies you with some helper functions to make sure you can\n\n### SimpleKeyValueStorage\n- `Future\u003cString?\u003e getValue({required String key})` (Get the value associated with the given key. Returns null if the value does not exist.)\n- `Future\u003cvoid\u003e setValue({required String key, required String value})` (Sets the value to be associated with the given key)\n- `Future\u003cbool\u003e hasValue({required String key})`` (Check if there is a value associated with the given key)\n- `Future\u003cvoid\u003e removeValue({required String key})` (Removes the value associated with the given key)\n\n### AfterLayout\nAdded the AfterLayout implementation in our plugin\n\n### Provider\n- `BaseProviderWidget` is a widget that can be used to easily generate the viewmodels for your screen.\nThe `create` function will be used to create your viewmodel\n`themeLookup` will be used to get your theme\n`localizationLookup` will be used to get your localization implementation\n\n- `BaseThemeProviderWidget` In some cases you need your theme or localizations you can use this in combination with the right builder function to get just that.\n\n### Widgets\n`ResponsiveWidget` (Will trigger the correct builder for your screensize)\n`TouchFeedBack` (Will implement inkwell on Android and a scale animation an iOS)\n`NativeDialog` Will show a dialog in the devices native style (Material/Cupertino)\n`LifecycleWidget` is a widget that accepts callback functions that are triggered on various lifecycle events.\n\n### Caching\n`SingleValueCache\u003cT\u003e` can be used to cache single values\n`KeyValueCache\u003cT\u003e` can be sed to cache values by key","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Fflutter-icapps-architecture","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficapps%2Fflutter-icapps-architecture","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficapps%2Fflutter-icapps-architecture/lists"}