Git Product home page Git Product logo

easy_localization_loader's Introduction

Custom assets loaders for Easy Localization package

Pub Version Code Climate issues GitHub closed issues GitHub contributors GitHub repo size GitHub forks GitHub stars

CodeFactor Grade GitHub license

Supported formats

  • JSON (JsonAssetLoader)
  • CSV (CsvAssetLoader)
  • HTTP (HttpAssetLoader)
  • XML (XmlAssetLoader, XmlSingleAssetLoader)
  • Yaml (YamlAssetLoader, YamlSingleAssetLoader)
  • FILE (FileAssetLoader)

Configuration

  1. Add this to your package's pubspec.yaml file:
dependencies:
  #Easy Localization main package
  easy_localization: <last_version>

    # stable version install from https://pub.dev/packages
  easy_localization_loader: <last_version>

  # Dev version install from git REPO
  easy_localization_loader:
    git: https://github.com/aissat/easy_localization_loader.git
  1. Change assetLoader and path
...
void main(){
  runApp(EasyLocalization(
    child: MyApp(),
    supportedLocales: [Locale('en', 'US'), Locale('ar', 'DZ')],
    path: 'resources/langs/langs.csv',
    assetLoader: CsvAssetLoader()
  ));
}
...
  1. All done!.

Loaders Specification

HttpAssetLoader

In order to use HttpAssetLoader you must provide a path to a folder (i.e. base path) where all your translations are placed like https://example.com/translations

Your translations should be created as separate files with .json extension. Placing translations as individual files reduces the size of the file to load on application init. Example:

translations/
├── en-US.json
└── uk-UA.json

easy_localization_loader's People

Contributors

abdulazizrasulbek avatar aissat avatar alexeyinkin avatar ariefwijaya avatar bw-flagship avatar deadsoul44 avatar frankdroid7 avatar fxschwartz avatar igokom avatar le-vlad avatar mauriziopinotti avatar nafiskabbo avatar nantaphop avatar vandir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

easy_localization_loader's Issues

[Important][Suggestion] Please upgrade http

Hello, I wanted to update the libraries I installed on my mobile application, but when I put the latest version of http, it tells me that easy_localization_loader is dependent on http ^0.12.0+2

Here is the entire error:

Because every version of easy_localization_loader depends on http ^0.12.0+2 and hover depends on http ^0.13.0, easy_localization_loader is forbidden.

So, because hover depends on easy_localization_loader ^0.0.2, version solving failed.
pub get failed (1; So, because hover depends on easy_localization_loader ^0.0.2, version solving failed.)
exit code 1

Can you change the version of http?

load from network

this library can be support getting locale from network when its available?

it seems this class don't work correctly and i get some error. reference

final String assetsLocalePath = 'assets/langs/';
    runApp(EasyLocalization(
      path: assetsLocalePath,
      useOnlyLangCode: true,
      child: MyApp(),
      assetLoader: AssetOrNetworkAssetLoader(
          assetsPath: assetsLocalePath,
          localCacheDuration: Duration(days: 1), // how long the localizations file should be kept
          localeUrl: (String localeName) =>  'http://example.com/$localeName'), // the URL for the remote locale file
      supportedLocales:
          supportedLocales.map((locale) => Locale(locale)).toList(),

The loader:

import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:connectivity/connectivity.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'package:path_provider/path_provider.dart';

const defaultTimeout = Duration(seconds: 1);

class AssetOrNetworkAssetLoader extends AssetLoader {
  /// The local URL method which accepts a [localeName] and returns the full distant
  /// localUrl
  final Function localeUrl;

  /// The timeout for downloading the distant localization files
  final Duration timeout;

  /// The default path for assets json files
  final String assetsPath;

  /// The duration before refreshing local localizations files with distant ones
  final Duration localCacheDuration;

  AssetOrNetworkAssetLoader(
      {@required this.localeUrl,
      this.timeout,
      this.assetsPath,
      this.localCacheDuration});

  @override
  Future<Map<String, dynamic>> load(String localePath) async {
    String string;
    String localeName =
        localePath.replaceFirst(assetsPath, '').replaceFirst('.json', '');

    // try loading local previously-saved localization file
    if (await localTranslationExists(localeName)) {
      string = await loadFromLocalFile(localeName);
    }

    // no local or failed, check if internet and download the file
    if (string == null && await isInternetConnectionAvailable()) {
      string = await loadFromNetwork(localeName);
    }

    // local cache duration was reached or no internet access but prefer local file to assets
    if (string == null &&
        await localTranslationExists(localeName, ignoreCacheDuration: true)) {
      string = await loadFromLocalFile(localeName);
    }

    // still nothing? Load from assets
    if (string == null) {
      string = await rootBundle.loadString(localePath);
    }

    // then returns the json file
    return json.decode(string);
  }

  @override
  Future<bool> localeExists(String localePath) => Future.value(true);

  Future<bool> isInternetConnectionAvailable() async {
    ConnectivityResult connectivityResult =
        await (Connectivity().checkConnectivity());
    if (connectivityResult == ConnectivityResult.none) return false;

    final result = await Future.any([
      InternetAddress.lookup('example.com'),
      Future.delayed(timeout ?? defaultTimeout)
    ]);

    if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
      return true;
    }

    return false;
  }

  Future<String> loadFromNetwork(String localeName) async {
    String url = localeUrl(localeName);

    try {
      final response = await Future.any(
          [http.get(url), Future.delayed(timeout ?? defaultTimeout)]);

      if (response != null && response.statusCode == 200) {
        String content = response.body.toString();

        // check valid json before saving it
        if (json.decode(content) != null) {
          await saveTranslation(localeName, content);
          return content;
        }
      }
    } catch (e) {
      print(e.toString());
    }

    return null;
  }

  Future<bool> localTranslationExists(String localeName,
      {bool ignoreCacheDuration: false}) async {
    File translationFile = await getFileForLocale(localeName);

    if (!await translationFile.exists()) {
      return false;
    }

    // don't check file's age
    if (!ignoreCacheDuration) {
      Duration difference =
          DateTime.now().difference(await translationFile.lastModified());

      if (difference > (localCacheDuration ?? Duration(days: 1))) {
        return false;
      }
    }

    return true;
  }

  Future<String> loadFromLocalFile(String localeName) async {
    return await (await getFileForLocale(localeName)).readAsString();
  }

  Future<void> saveTranslation(String localeName, String content) async {
    File file = await new File(await getFilenameForLocale(localeName))
        .create(recursive: true);
    return file.writeAsString(content);
  }

  Future<String> get _localPath async {
    final directory = await getTemporaryDirectory();

    return directory.path;
  }

  Future<String> getFilenameForLocale(String localeName) async {
    return "${await _localPath}/langs$localeName.json";
  }

  Future<File> getFileForLocale(String localeName) async {
    return File(await getFilenameForLocale(localeName));
  }
}

Null safety

Is there any plan to add null safety to the package?

Thanks for your work

Null safety

Please add support for null safety
The current Dart SDK version is 3.1.0.

Because easy_localization_loader >=1.0.0 <1.0.1 depends on http ^0.13.1 and easy_localization_loader
<1.0.0 doesn't support null safety, easy_localization_loader <1.0.1 requires http ^0.13.1.
And because easy_localization_loader >=1.0.1 depends on http ^0.13.5, every version of
easy_localization_loader requires http ^0.13.1.
So, because serv_u depends on both http ^1.1.0 and easy_localization_loader any, version solving failed.

The lower bound of "sdk: '>=2.7.0 <3.0.0'" must be 2.12.0 or higher to enable null safety.

JSON issues

I get no translations if I use the JsonAssetLoader().

Error while generate CSV file

image

I got error while generate file with csv file in example. I try to remove all file json and xml and some stuff, just only have csv file and generate. When i generate i got this error.
This is my terminal to run

flutter pub run easy_localization:generate -s langs.csv

XML dependencies update

Could you upgrade the XML version to higher? Because when i'm using Excel package, flutter will cannot be build due to the low version of XML.

Even i know that just change the cache code from .value to .text, but i dun think this is a good solution.

Thank you for your reading, and sorry for my poor English.

Asset loader only works if the application is reloaded

Hi,
just starting to add the assett loader and easy localisation in my application.
If I build and run my application on my pc both the emulator and the usb connected phone work perfectly using the correct languages depending on the locale defined.
If I build the app using a CI/CD tool (codemagic.io) the assett loader stops working showing the strings ids instead of the translation.
If I attch and debug from android studio still doesnt work, but once I reload the application directly from Android studio now the locales are working.
Looks like then there is an initialization problem.

The code in main.dart is:

`
import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization_loader/easy_localization_loader.dart';
..

void main() {
runApp(EasyLocalization(
supportedLocales: [Locale('en', 'US'), Locale('it', 'IT')],
fallbackLocale: Locale('en', 'US'),
path: 'assets/translations/langs.csv',
assetLoader: CsvAssetLoader(),
child: MyApp(),
));
}`

class MyApp extends StatelessWidget { ... localizationsDelegates: context.localizationDelegates, supportedLocales: context.supportedLocales, locale: context.locale,

Can you please help me in solving the error?

Thanks

Cannot upgrade sheet_loader_localization to the latest 0.3.0, since it depends on csv ^6.0.0 and easy_localization_loader depends on some lower version of csv, please upgrade

When I try to upgrade sheet_loader_localization to the latest 0.3.0 I get the message:

Because easy_localization_loader >=1.0.1 depends on csv ^5.0.1 and sheet_loader_localization >=0.3.0 depends on csv ^6.0.0, easy_localization_loader >=1.0.1 is incompatible with sheet_loader_localization >=0.3.0.

Pleeease 🙏 upgrade the version of csv ASAP, because eventually following the chain of the different dependencies this prevents our team from upgrading Flutter to the latest version 3.22.

arb file loader

How do we use arb file since it is considered recommended?

AssetOrNetworkAssetLoader

I want to solve this issue please.....

this library can be support getting locale from network when its available?

it seems this class don't work correctly and i get some error. reference

final String assetsLocalePath = 'assets/langs/';
    runApp(EasyLocalization(
      path: assetsLocalePath,
      useOnlyLangCode: true,
      child: MyApp(),
      assetLoader: AssetOrNetworkAssetLoader(
          assetsPath: assetsLocalePath,
          localCacheDuration: Duration(days: 1), // how long the localizations file should be kept
          localeUrl: (String localeName) =>  'http://example.com/$localeName'), // the URL for the remote locale file
      supportedLocales:
          supportedLocales.map((locale) => Locale(locale)).toList(),

The loader:

import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:connectivity/connectivity.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;
import 'package:path_provider/path_provider.dart';

const defaultTimeout = Duration(seconds: 1);

class AssetOrNetworkAssetLoader extends AssetLoader {
  /// The local URL method which accepts a [localeName] and returns the full distant
  /// localUrl
  final Function localeUrl;

  /// The timeout for downloading the distant localization files
  final Duration timeout;

  /// The default path for assets json files
  final String assetsPath;

  /// The duration before refreshing local localizations files with distant ones
  final Duration localCacheDuration;

  AssetOrNetworkAssetLoader(
      {@required this.localeUrl,
      this.timeout,
      this.assetsPath,
      this.localCacheDuration});

  @override
  Future<Map<String, dynamic>> load(String localePath) async {
    String string;
    String localeName =
        localePath.replaceFirst(assetsPath, '').replaceFirst('.json', '');

    // try loading local previously-saved localization file
    if (await localTranslationExists(localeName)) {
      string = await loadFromLocalFile(localeName);
    }

    // no local or failed, check if internet and download the file
    if (string == null && await isInternetConnectionAvailable()) {
      string = await loadFromNetwork(localeName);
    }

    // local cache duration was reached or no internet access but prefer local file to assets
    if (string == null &&
        await localTranslationExists(localeName, ignoreCacheDuration: true)) {
      string = await loadFromLocalFile(localeName);
    }

    // still nothing? Load from assets
    if (string == null) {
      string = await rootBundle.loadString(localePath);
    }

    // then returns the json file
    return json.decode(string);
  }

  @override
  Future<bool> localeExists(String localePath) => Future.value(true);

  Future<bool> isInternetConnectionAvailable() async {
    ConnectivityResult connectivityResult =
        await (Connectivity().checkConnectivity());
    if (connectivityResult == ConnectivityResult.none) return false;

    final result = await Future.any([
      InternetAddress.lookup('example.com'),
      Future.delayed(timeout ?? defaultTimeout)
    ]);

    if (result.isNotEmpty && result[0].rawAddress.isNotEmpty) {
      return true;
    }

    return false;
  }

  Future<String> loadFromNetwork(String localeName) async {
    String url = localeUrl(localeName);

    try {
      final response = await Future.any(
          [http.get(url), Future.delayed(timeout ?? defaultTimeout)]);

      if (response != null && response.statusCode == 200) {
        String content = response.body.toString();

        // check valid json before saving it
        if (json.decode(content) != null) {
          await saveTranslation(localeName, content);
          return content;
        }
      }
    } catch (e) {
      print(e.toString());
    }

    return null;
  }

  Future<bool> localTranslationExists(String localeName,
      {bool ignoreCacheDuration: false}) async {
    File translationFile = await getFileForLocale(localeName);

    if (!await translationFile.exists()) {
      return false;
    }

    // don't check file's age
    if (!ignoreCacheDuration) {
      Duration difference =
          DateTime.now().difference(await translationFile.lastModified());

      if (difference > (localCacheDuration ?? Duration(days: 1))) {
        return false;
      }
    }

    return true;
  }

  Future<String> loadFromLocalFile(String localeName) async {
    return await (await getFileForLocale(localeName)).readAsString();
  }

  Future<void> saveTranslation(String localeName, String content) async {
    File file = await new File(await getFilenameForLocale(localeName))
        .create(recursive: true);
    return file.writeAsString(content);
  }

  Future<String> get _localPath async {
    final directory = await getTemporaryDirectory();

    return directory.path;
  }

  Future<String> getFilenameForLocale(String localeName) async {
    return "${await _localPath}/langs$localeName.json";
  }

  Future<File> getFileForLocale(String localeName) async {
    return File(await getFilenameForLocale(localeName));
  }
}

HttpAssetLoader()

I am having 3 Yaml files to load over Http

How the HttpAssetLoader() is working? What files does it expect?

[Feature Request] Add web support

easy_localization supports web compatibility but easy_localization_loader does not due to the use of path_provider. So we will get a MissingPluginException error when running on the web.

image

Solution: We can add conditional usage based on platform

[Feature request] Google Sheet as translation resource

Can a Google Sheet be added as a translation resource?

The usecase and the process would be like this:

  • create a Google Sheet where the first column contains keys and subsequent columns would contain language IDs
  • share the sheet with everyone with a link
  • extract the DocID and SheetID values: DocID would sit, in the shared URL, between spreadsheets/d/ and /edit while the sheet ID would be the #gid= parameter from the URL when we pen the sheet in browser (if it's the first sheet, the sheet ID is - 0)
  • we define the docID and sheetID variables

Apart from reducing complexity of sharing a translation resource, we can also use the Google's automated translation in sheets this way.

An example code (utilizing the http package) that extracts CSV from a shared Google sheet would be something like:

import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;

Future<void> downloadCsvFromGoogleSheet(String documentId, String sheetId) async {
  // Set the API endpoint for the Google Sheets API
  var endpoint = 'https://docs.google.com/spreadsheets/d/$documentId/export?format=csv&id=$documentId&gid=$sheetId';
  
  // Send a request to the API to get the CSV data
  var response = await http.get(endpoint);
  
  // Check if the request was successful
  if (response.statusCode == 200) {
    // Write the response content (the CSV data) to a local file
    var file = File('$sheetId.csv');
    await file.writeAsString(utf8.decode(response.bodyBytes));
    print('CSV data successfully saved to $sheetId.csv');
  } else {
    print('Request failed with status code ${response.statusCode}');
  }
}

// Example usage:
void main() {
  var documentId = 'your_document_id_here';
  var sheetId = 'your_sheet_id_here';
  downloadCsvFromGoogleSheet(documentId, sheetId);
}

I could also try to do a PR with this addition.

Localization issues with CSV loader for iOS/macOS

This is a duplicate of issue #190 that was filed for easy_localization (not loader). But since that has been labeled as fixed and closed, but the bug is still present in the official version and the fix has never been merged I thought I'd create this new one to get it back onto the table ;-)

I can confirm that with the latest version on pub.dev as of today CSV files that worked while building for Android on Windows 10 fail to load the csv translations when building for iOS on Mac OS (Big Sur).

I can also confirm that the proprosed fix completely resolves the issue.
It would be great if you could make that fixed version available via pub.dev too. Thanks!!

(Reminder or for new users looking for this the fix is using this version in your pubspec.yaml:)

  easy_localization_loader:
    git:
      url: git://github.com/aissat/easy_localization_loader.git
      ref: overman-dev```

[Suggestion] Explanation for CSV format

Hello,

Thank you for your package, it is very helpful.

I make a suggestion: it would be nice to explain a little bit some things about the CSV format (and maybe for others formats).

I made several tests to understand what it was possible to do with CSV format.

So I know now that CSV works only:

  • with only comma separator (semicolon or other separator are not accepted)

  • with non-printable control character CRLF (Carriadge Return and Line Feed) and not only LF (Line Feed)

  • with a specific header : str,en_US,fr_FR, and so on

  • with or without double quotes

  • the key can be a keyword or simply the english version... we can mix the 2 ways, for instance:

"str","en_US","fr_FR"
"button to change the language into french","button to change the language into french","bouton pour passer l'application en langue anglaise"
"form.error.client_user.not_valid","please enter a valid user","merci de saisir un utilisateur valide"

  • and when we change a translation, we need to rebuild the whole application

Personally, with each modification, I redo a sort on the CSV file according to the key to reorder everything in alphabetical order to identify possible duplicates.
Do not forget to put the header back in the 1st line afterwards.

Issue with assetLoader: HttpAssetLoader().

It seems to be downloading the assets from the url as i can see it in the response, but the .tr() method fails to read the key from the file. Please find the below implementation

image

This is the code i m using

import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:easy_localization_loader/easy_localization_loader.dart';

Future main() async {
WidgetsFlutterBinding.ensureInitialized();
await EasyLocalization.ensureInitialized();
runApp(
EasyLocalization(
supportedLocales: [Locale('en'), Locale('hi')],
startLocale: Locale('en'),
useOnlyLangCode: true,
path:
'https://translations-web-three.vercel.app/assets', // <-- change the path of the translation files
fallbackLocale: Locale('en'),
assetLoader: HttpAssetLoader(),
child: MyApp()),
);
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@OverRide
Widget build(BuildContext context) {
return MaterialApp(
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}

class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@OverRide
State createState() => _MyHomePageState();
}

class _MyHomePageState extends State {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}

@OverRide
Widget build(BuildContext context) {
print(context.locale.toString());
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(context.tr('title')), // => This doesn't seem to work
),
body: Center(
child: Text(
'This is a localization example',
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}

The error in debug console

Restarted application in 99ms.
[log] easy localization loader: load http https://translations-web-three.vercel.app/assets
[🌎 Easy Localization] [DEBUG] Localization initialized
[🌎 Easy Localization] [DEBUG] Start
[🌎 Easy Localization] [DEBUG] Init state
[🌎 Easy Localization] [INFO] Start locale loaded en
[🌎 Easy Localization] [DEBUG] Build
[🌎 Easy Localization] [DEBUG] Init Localization Delegate
[🌎 Easy Localization] [DEBUG] Init provider
[🌎 Easy Localization] [DEBUG] Load Localization Delegate
https://translations-web-three.vercel.app/assets/en.json
26
{'title: Hello!}
en
[🌎 Easy Localization] [WARNING] Localization key [title] not found

cannot update to the latest version of connectivity_plus ^6.0.2 getting issue with easy_localization_loader library it depends on version ^5.0.1 , both the libraries are depend each other , please do something

Uploading bug report screenshot.png…
when i try to update the latest version of connectivity_plus library i am getting this issue
Resolving dependencies...
Because easy_localization_loader 2.0.1 depends on connectivity_plus ^5.0.1 and no versions of easy_localization_loader match >2.0.1 <3.0.0,
easy_localization_loader ^2.0.1 requires connectivity_plus ^5.0.1.
So, because myproject depends on both easy_localization_loader ^2.0.1 and connectivity_plus ^6.0.2, version solving failed.

this is the issue can it depends on easy_localization_loader library version 2.0.1 so can't update to latest version
please do something.

easy_localization_loader ^0.0.2 is incompatible with flutter_svg >=0.18.0

Because no versions of easy_localization_loader match >0.0.2 <0.1.0 and easy_localization_loader 0.0.2 depends on xml ^3.5.0, easy_localization_loader ^0.0.2 requires xml ^3.5.0.
Because flutter_svg >=0.18.1 depends on xml ^4.2.0 and flutter_svg >=0.18.0 <0.18.1 depends on xml ^4.1.0, flutter_svg >=0.18.0 requires xml ^4.1.0.
Thus, easy_localization_loader ^0.0.2 is incompatible with flutter_svg >=0.18.0.
So, because cip depends on both flutter_svg ^0.18.0 and easy_localization_loader ^0.0.2, version solving failed.
Running "flutter pub get" in cip...
pub get failed (1; So, because cip depends on both flutter_svg ^0.18.0 and easy_localization_loader ^0.0.2, version solving failed.)

HttpAssetLoader() not supported

Hi, I am try to call assetLoader: HttpAssetLoader() but HttpAssetLoader() is undefined.
I added easy_localization and easy_localization_loader in ymal but still not reading. Need your response. Thank you

Migrate and Use string.xml from Android to Flutter

I want to ask that is it's possible to use string.xml(english) and string.xml(spanish) to use in flutter? If yes then how? I have loaded both the files in flutter /assets/translations and also loaded XmlAssetLoader. I don't know how to use it, now. As there's no generator as of now for XML unlike json, how to use this package with xml?

HTTP parameters for SmartNetworkLoader

Sometimes it's needed to specify additional parameters for an HTTP request. In my case I need to pass an api token in the header to be able to get access to my localization service (Localizely).
Currently the loader takes String URL. I think it would be better to change it to HTTP object instead, so user can shape the request as he\she needs. Just a suggestion.

extend autodetect

I started to get errors with the last update due to auto detection of csv settings. I use ; as fieldDelimiter and as textDelimiter. Either these should be added or the library should be extendable.

`connectivity_plus ^3.0.3` conflicts with `easy_localization_loader ^1.0.1+1`

What's Wrong

As of press time, the latest connectivity_plus is v3.0.3, but easy_localization_loader still depends on the old one ^2.3.7.

In easy_localization_loader/pubspec.yaml.

connectivity_plus: ^2.3.7

And connectivity_plus is used in smart_network_asset_loader.

Log

Running "flutter pub get" in my_app...
Resolving dependencies...
Because my_app depends on easy_localization_loader ^1.0.1+1 which depends on connectivity_plus ^2.3.7, connectivity_plus ^2.3.7 is required.
So, because my_app depends on connectivity_plus ^3.0.3, version solving failed.

My Solutions

  1. To separate smart_network_asset_loader from the easy_localization_loader. As to Single-responsibility principle, an asset loader should not mess with the connectivity of user devices.
    It sounds cumbersome, but there has been issued before: #41 #36.
  2. To upgrade connectivity_plus depenedency. It's straightforward.
  3. Since every asset loader is in a single file, it's easy to copy which loader you want direcly without adding to pubspec.yaml.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.