Is there any way to scan a credit card in flutter? i tried Card IO plug in and i tried using it but when i open the camera, it just shows me a box and when i focus on the card nothing happens.
Package used: https://pub.dartlang.org/packages/flutter_card_io
FlatButton(
onPressed: () async {
Map<String, dynamic> details = await FlutterCardIo.scanCard({
"requireExpiry": true,
"scanExpiry": true,
"requireCVV": false,
"requirePostalCode": false,
"restrictPostalCodeToNumericOnly": false,
"requireCardHolderName": false,
"scanInstructions": "Fit the card within the box",
});
print(details);
},
child: Text("Test"),
),
pubspec.yaml
dependencies:
flutter_card_io:
git:
url: git://github.com/procedurallygenerated/flutter_card_io.git
If there is any possible way that anyone knows of i would be grateful! I really need it for an important project i am doing.
A little late to the party I know, but I tried installing CardIO (the core one and the flutter one) anyway... Not only are they no longer maintained but they're not compatible :(
I got these errors on pub get.
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.10 and higher. project ':core_card_io' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71
core_card_io: ^0.0.2
Because myapp depends on flutter_card_io >=0.0.2 which requires SDK version >=1.8.0 <2.0.0, version solving failed.
flutter_card_io: ^0.0.3
So I found an alternative which does seem to do the job.
card_scanner 0.0.4
https://pub.dev/packages/card_scanner
https://pub.dev/documentation/card_scanner/latest/
https://github.com/nateshmbhat/card-scanner-flutter/blob/master/example/lib/main.dart
If you have another one to share, please do :)
Currently, there seems to be no other plugin publicly available for Flutter. However, the one you mentioned should work fine. Try compiling the example application that comes with the plugin and use multiple cards to test it. Keep in mind that Card.io only works with cards that have raised digits.
Related
Can we add a feature in our flutter app where we can tap on the existing places that are shown in the google map can get the details of that place? Instead of adding a custom marker and get the lat long information, I want to display a marker on that particular place and get its detailed info
Unfortunately no. For some strange reason, the OnPoiClickListener hasn't been implemented in the google_maps_flutter plugin, although it is available in the native Google Maps SDK (at least on Android).
There is a feature request on the Flutter Github issues page, please go there and upvote the original question to let the Flutter team know that this feature is needed.
I don't know why but they haven't implemented it in flutter, i uploaded a repo with changes to make it available (by referencing matthiasng/plugins#17ea7f3), just add this in your pubspec.yaml
google_maps_flutter:
git:
url: https://github.com/riccardo-runci/google_maps_flutter.git
ref: main
google_maps_flutter_platform_interface:
git:
url: https://github.com/riccardo-runci/google_maps_flutter_platform_interface.git
ref: main
and in the GoogleMap widget
GoogleMap(
...
onPoiTap: (argument) {
...
}
)
it is aligned with the version 2.2.3
I am new to Flutter and I feel like if I could see what the widgetTest is "rendering", as a debug method, things could be a bit easier. I don't fully understand at the moment the mechanics of the widgetTest, but I am wondering if it is possible to capture an actual output render in the middle of the widgetTest.
I am talking about widgetTest not integration test.
I think the package golden_toolkit might be what you are looking for. Instead of using widgetTest you will be using testGoldens. And you can even compare screenshots if you want to ensure non regression in your UI using the provided method screenMatchesGolden.
Add in your pubspec.yaml:
#This is a development environment dependency only
dev-dependencies:
golden_toolkit: ^0.9.0
Code Sample:
testGoldens('MyWidget test', (tester) async {
await tester.pumpWidget(MyWidget());
await screenMatchesGolden(tester, 'my_widget-example');
});
Then run the following command to generate or regenerate your reference images:
flutter test --update-goldens
You can check the documentation about testGoldens here.
This is the similar question (with wrong title): Flutter Web - How to reload currently Active Page
Running the Flutter web app as PWA I need to allow users to initiate refresh and thus update the (web) app.
Unfortunately import 'dart:html' as html; is not allowed anymore when having the same codebase for web and mobile native apps. So following code is not the option:
RaisedButton(
child: Text("Update me"),
onPressed: () {
if (kIsWeb) html.window.location.reload();
},
),
What is the correct approach?
EDIT:
I have managed to use 'dart:js' in the same codebase for pwa and mobile using conditional imports. This means I can call JavaScript from within the Flutter code. Unfortunately location.reload(true); does not reload the PWA.
Ideally I would have the Flutter approach for the PWA reload / update or JavaScript workaround.
EDIT2:
The whole issue is within the PWA handling of refresh button / window reload.
Unfortunately service worker's skipWaiting() can be called only from within service worker ( https://developers.google.com/web/fundamentals/primers/service-workers/lifecycle#skip_the_waiting_phase )
The correct approach seams to be sending the skipWaiting message to the new instance of the service worker.
However skipWaiting is not yet fully supported on some browsers (iOS?) so the safer approach seams to be just unregistering the worker...
I ended up using following to stop the worker and reload.
if ('serviceWorker' in navigator) {
navigator.serviceWorker.getRegistration().then(swr => {swr.unregister().then(
() => {location.reload(true)}
)});
} else {location.reload(true)}
Related:
Access service worker skipWaiting from within App build with Webpack+Workbox
https://medium.com/#nekrtemplar/self-destroying-serviceworker-73d62921d717
https://redfin.engineering/how-to-fix-the-refresh-button-when-using-service-workers-a8e27af6df68
https://deanhume.com/displaying-a-new-version-available-progressive-web-app/
Flutter 2.10.3
In the newest version of Flutter (2.10.3 at the time of writing this), PWAs will automatically update when the serviceWorkerVersion changes in your index.html file.
From this issue, Jonah Williams comments:
"The app will update after the new version has been downloaded and the page revisited."
You can read more about general PWA support by Flutter here. For the pull request that added server worker support, see this.
If you want to allow users to manually fetch a new version of your app, you can use the universal_html package which works on all platforms.
import 'package:universal_html/html.dart' as html;
onTap: () {
html.window.location.reload();
},
Keep an eye on this issue for an improvement to how server worker caching is handled.
A work around would be to navigate to your apps entry point route '/'
`Navigator.of(context).pushNamedAndRemoveUntil(
'/,
(Route<dynamic> route) => false
);`
I maintain a set of web versions myself. When I upgrade my web application, I will upgrade the version level. Every time I start homePage, I will request the version number of the remote configuration to match the version number of the current PWA application. When the local version number is lower than the remote version number, I will refresh
//pubspec.yaml universal_html: ***
import 'package:universal_html/html.dart' as html;
getWebVersion() async{
var res= await dio.get(web_version);
if (locaVersion < res.version) {
html.window.location.reload();
}
}
I am following this and this tutorial to integrate stripe payment into my flutter project. Both of these tutorials/examples reference the class StripeSource by calling its method
StripeSource.setPublishableKey("pk_test");
but this class seems to be missing from the latest stripe package for a flutter. I've added the flutter SDK using stripe_payment: ^1.0.0 in my pubspec.yaml file and other stripe classes are available.
Any help is highly appreciated :-).
Those tutorial are outdated. The library changed and now it works in a different way. Instead of using StripeSource, you should use StripePayment.
For example:
StripePayment.setOptions(StripeOptions(
publishableKey:
'YOUR_TEST_PUBLISH_KEY'));
StripePayment.paymentRequestWithCardForm(
CardFormPaymentRequest())
.catchError((e) {
print('ERROR ${e.toString()}');
}).then((paymentMethod) {
//DO SOMETHING WITH YOUR PAYMENT METHOD
});
EDIT
What matters to follow those tutorials, is to optain the 'token'. As it is not very clear and there is not a complete documentation, I want to point out that:
paymentMethod.id is equal to the token returned by StripeSource.addSource() in the old versions.
Query
I want to adding account with AccountManager in Flutter.
I have googled but I found in Android not in Flutter; I found flutter package:
https://pub.dev/packages/account_manager_plugin
this package get all account but never to add new account.
any body help me...
Currently, there is no available plugin that has all the features of Android’s AccountManager. You’ll either have to dive into its source to jumpstart and create your own plugin, wait for one to be available, or integrate your own Android-specific code.