Comments (6)
Hi @b-stud, Thanks for your report.
Actually, I don't know what's wrong (in your case). The extension working well in my (Advan & Alcatel phones) marshmallow OS phones. Because I am creating this extension to fulfill my mobile app project too. And the application running wells, AFAIK my users using marshmallow OS too (internal company app).
The error is thrown by the following code execution:
FlutterMoneyFormatter._getOutput(package:flutter_money_formatter/src/flutter_money_formatter_base.dart:91:18)
Based on the error message above, the problem raised when searching position of decimal/precision separator char. But, I am not sure why the index returning -1
on your S9+.
I will do some investigation to solve this problem.
P.S:
Oh, can you give me some little pieces of your code to reproduce the error? Because your sample case is still running well on my demo apps (tested with real device).
from flutter_money_formatter.
Hi @b-stud, Thanks for your report.
Actually, I don't know what's wrong (in your case). The extension working well in my (Advan & Alcatel phones) marshmallow OS phones. Because I am creating this extension to fulfill my mobile app project too. And the application running wells, AFAIK my users using marshmallow OS too (internal company app).
The error is thrown by the following code execution:
FlutterMoneyFormatter._getOutput(package:flutter_money_formatter/src/flutter_money_formatter_base.dart:91:18)
Based on the error message above, the problem raised when searching position of decimal/precision separator char. But, I am not sure why the index returning
-1
on your S9+.I will do some investigation to solve this problem.
P.S:
Oh, can you give me some little pieces of your code to reproduce the error? Because your sample case is still running well on my demo apps (tested with real device).
For sure, I'm using the EventBrite Http API to get a price and a currency, I wrap everything on an Event class as below. Of course I debugged these values (price and currency) to ensure everything is as expected, which is the case, moreover, as it only occurs on some devices, I don't think the problem comes from here.
class Event {
...
final double price;
final String currency;
...
Event({
...
@required this.price,
@required this.currency,
...
});
}
// I'm using the eventbrite API
static Event _parseEventData(Map<String, dynamic> eventData, Position userPosition) {
return (Event(
...
price: eventData['ticket_availability']['minimum_ticket_price']['value'] / 100,
currency: eventData['ticket_availability']['minimum_ticket_price']['currency'],
...
));
}
Map<String, dynamic> eventRaw = await callAPI(parameters, _getEventDetailsUri);
core.Event event = _parseEventData(eventRaw);
FlutterMoneyFormatter(amount: event.price, settings: MoneyFormatterSettings(symbol: event.currency))
.output
.symbolOnRight))
from flutter_money_formatter.
Hi @b-stud, Since I don't have S9+ device, so what I can do is only testing it on emulator (oreo OS as used by S9+). But, I still have no clue about this problem, so I can't update this solution to the pub.dartlang.org nor to this repository.
So here are my quick fix, solution:
- Download (or fork) this project.
- Replace
_getOutput()
method fromflutter_money_formatter_base.dart
file which located onlib/src/
directory, with the syntaxes on below: - Build and copy the APK from the
example
directory and install it to your phone.
MoneyFormatterOutput _getOutput() {
_utilities = _Utilities(amount: this.amount, settings: this.settings);
String _urs = _utilities.refineSeparator;
int _decSepCharPos = _urs.indexOf(this.settings.decimalSeparator);
return MoneyFormatterOutput(
nonSymbol: _urs,
symbolOnLeft: '${this.settings.symbol}${_utilities.spacer}$_urs',
symbolOnRight: '$_urs${_utilities.spacer}${this.settings.symbol}',
compactNonSymbol: _compactNonSymbol,
compactSymbolOnLeft:
'${this.settings.symbol}${_utilities.spacer}$_compactNonSymbol',
compactSymbolOnRight:
'$_compactNonSymbol${_utilities.spacer}${this.settings.symbol}',
fractionDigitsOnly:
_urs.substring((-1 == _decSepCharPos ? 0 : _decSepCharPos + 1)),
withoutFractionDigits:
_urs.substring(0, -1 == _decSepCharPos ? _urs.length - 1 : _decSepCharPos)
);
}
Since I can't test it on S9+ device, would you like to test it for me? And please let me know the result.
P.S:
I think this quick solution will make another problem when you fetch the value from fractionDigitsOnly
and withoutFractionDigits
.
from flutter_money_formatter.
Hi @fadhly-permata I just forked your repository and replaced the _getOutput
method with the one you wrote above, it definitely does work, at least, the error concerning the range error is not present anymore.
Concerning the potential problems with fractionDigitsOnly
and withoutFractionDigits
I'm not using them so I'm not sure if it created another bug, I can try something if you wish.
Thank you for your reactivity!
from flutter_money_formatter.
Hi @b-stud, I've released the update for this issue on https://pub.dev
Thanks
from flutter_money_formatter.
Hello @fadhly-permata, thank you so much for your work, it's working perfectly now!
from flutter_money_formatter.
Related Issues (20)
- Decimal view HOT 4
- Locale in formatter HOT 1
- Support intl 0.16.0 HOT 3
- Dependency conflict with intl v0.16.0 HOT 5
- Library unusable on Dutch locale HOT 1
- Remove ios and android folders
- coflict
- Incompatibility with flutter 1.12.13-hotfixes HOT 8
- Upgrade intl version to 0.16.0 HOT 1
- Flutter Money Formatter is not compatible with intl 0.16.1 HOT 1
- Is this package maintain? HOT 1
- output.withoutFractionDigits doesn't give the expected result
- Cannot run with valid yaml
- Update intl HOT 17
- How do I use it within a listView?
- null safety HOT 2
- Update to Android V2 embedding HOT 2
- How to change amount HOT 1
- Add option to set significantDigits for compact format
- format error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_money_formatter.