I have a sqflite database that works, unit tests work. I want to call a sqflite method in onTap method. I understand I cannot execute the sqflite function in the main UI thread (Flutter tells me that at runtime). So I created an Isolate to call the sqflite function, which gives a different error. The Isolate works if I don't call the sqflite function, works if I just return a bool. Here is the code and exception - thanks for any suggestions:
Snippet from UI
Widget loginButton(BuildContext context) {
return Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 20.0, right: 5.0, top: 20.0, bottom: 0.0),
child: GestureDetector(
onTap: () {
if (emailController.text.length > 1 && passwordController.text.length > 7) {
/// Find user. Then...
doCheckIfFoundUser(emailController.text.trim(), passwordController.text);
} else {
printUserNotFound();
}
},
child: buttonContainer(Colors.indigo, "Login", 20.0),
),
),
);
Method called from UI
doCheckIfFoundUser(String email, String password) async {
var result;
List<String> emailPasswordList = new List();
emailPasswordList.add(email);
emailPasswordList.add(password);
var receivePort = new ReceivePort();
Isolate.spawn(callbackFunction, receivePort.sendPort);
SendPort sendPort = await receivePort.first;
var ans = await sendReceive(sendPort, emailPasswordList);
setState(() {
result = ans;
print("The value is $result - please do your thing");
});
}
Isolate Callback
static void callbackFunction(SendPort callerSendPort) async {
ReceivePort newIsolateReceivePort = ReceivePort();
callerSendPort.send(newIsolateReceivePort.sendPort);
var msg = await newIsolateReceivePort.first;
List<String> emailPasswordList = msg[0];
print("email: ${emailPasswordList[0]}, password: ${emailPasswordList[1]}");
bool foundUser = await searchForUser(emailPasswordList[0], emailPasswordList[1]);
SendPort replyPort = msg[1];
replyPort.send(foundUser);
}
Future sendReceive(SendPort send, message) {
ReceivePort receivePort = ReceivePort();
send.send([message, receivePort.sendPort]);
return receivePort.first;}
I/flutter ( 2073): email: email, password: Passw0rd
E/flutter ( 2073): [ERROR:flutter/runtime/dart_isolate.cc(805)] Unhandled exception:
E/flutter ( 2073): error: native function 'Window_sendPlatformMessage' (4 arguments) cannot be found
E/flutter ( 2073): #0 Window.sendPlatformMessage (dart:ui/window.dart:1089:9)
E/flutter ( 2073): #1 _DefaultBinaryMessenger._sendPlatformMessage (package:flutter/src/services/binary_messenger.dart:85:15)
E/flutter ( 2073): #2 _DefaultBinaryMessenger.send (package:flutter/src/services/binary_messenger.dart:129:12)
E/flutter ( 2073): #3 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:309:51)
E/flutter ( 2073):
E/flutter ( 2073): #4 invokeMethod (package:sqflite/src/sqflite_impl.dart:18:34)
E/flutter ( 2073):
E/flutter ( 2073): #5 SqfliteDatabaseFactoryImpl.invokeMethod (package:sqflite/src/factory_impl.dart:33:7)
E/flutter ( 2073): #6 _SqfliteDatabaseFactoryImpl&Object&SqfliteDatabaseFactoryMixin.safeInvokeMethod. (package:sqflite/src/factory_mixin.dart:22:35)
E/flutter ( 2073): #7 wrapDatabaseException (package:sqflite/src/exception_impl.dart:7:34)
E/flutter ( 2073): .
E/flutter ( 2073): #8 SqfliteDatabaseFactoryImpl.wrapDatabaseException (package:sqflite/src/factory_impl.dart:29:7).
E/flutter ( 2073): #9 _SqfliteDatabaseFactoryImpl&Object&SqfliteDatabaseFactoryMixin.safeInvokeMethod (package:sqflite/src/factory_mixin.dart:22:7).
E/flutter ( 2073): #10 _SqfliteDatabaseFactoryImpl&Object&SqfliteDatabaseFactoryMixin.getDatabasesPath (package:sqflite/src/factory_mixin.dart:136:17).
E/flutter ( 2073):
E/flutter ( 2073): #11 getDatabasesPath. (package:sqflite/sqflite.dart:166:54)
E/flutter ( 2073): #12 UsersSqflite.init (package:himrepo/controller/users_database.dart:20:47).
E/flutter ( 2073): .
E/flutter ( 2073): #13 _LoginPageState.searchForUser. (package:himrepo/ui/login.dart:268:24).
E/flutter ( 2073): .
E/flutter ( 2073): #14 _LoginPageState.callbackFunction(package:himrepo/ui/login.dart:166:28).
E/flutter ( 2073): .
E/flutter ( 2073): #15 _startIsolate.. (dart:isolate-patch/isolate_patch.dart:304:17).
E/flutter ( 2073): #16 _RawReceivePortImpl._handleMessage(dart:isolate-patch/isolate_patch.dart:172:12).
Executing Sqflite method directly gives
E/AndroidRuntime( 6628): FATAL EXCEPTION: Sqflite
E/AndroidRuntime( 6628): java.lang.RuntimeException: Methods marked with #UiThread must be executed on the main thread. Current thread: Sqflite
E/AndroidRuntime( 6628): at io.flutter.embedding.engine.FlutterJNI.ensureRunningOnMainThread(FlutterJNI.java:794)
E/AndroidRuntime( 6628): at io.flutter.embedding.engine.FlutterJNI.invokePlatformMessageResponseCallback(FlutterJNI.java:727)
E/AndroidRuntime( 6628): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:140)
E/AndroidRuntime( 6628): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:225)
E/AndroidRuntime( 6628): at com.tekartik.sqflite.SqflitePlugin$6.run(SqflitePlugin.java:778)
E/AndroidRuntime( 6628): at android.os.Handler.handleCallback(Handler.java:873)
E/AndroidRuntime( 6628): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 6628): at android.os.Looper.loop(Looper.java:193)
E/AndroidRuntime( 6628): at android.os.HandlerThread.run(HandlerThread.java:65)
Thanks to #pskink for helping. The Isolate works, but I was getting exceptions when running sqflite from a Widget onTap event. It turned out that a plugin (json_annotation) I included in my pubspec.yaml was somehow contributing to the exception: "Methods marked with #UiThread must be executed on the main thread. Current thread: Sqflite". After removing that plugin the app works.
Related
I have a method thats called to load models but seems to crash every time I call it, I followed the documentation for it I believe so I dont understand why.
Future loadModel() async {
await FirebaseModelDownloader.instance
.getModel(
"Breed-Detector",
FirebaseModelDownloadType.latestModel,
FirebaseModelDownloadConditions(
iosAllowsCellularAccess: true,
iosAllowsBackgroundDownloading: false,
androidChargingRequired: false,
androidWifiRequired: false,
androidDeviceIdleRequired: false,
))
.then((customModel) async {
final localModelPath = customModel.file;
Tflite.close();
String res;
res = (await Tflite.loadModel(
model: localModelPath.toString(), labels: "assets/labels.txt"))!;
print("Models Loading status: ${res}");
});
}
I get the error
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(Failed to load model, flutter_assets/File: '/data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Breed-Detector/0', java.io.FileNotFoundException: flutter_assets/File: '/data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Breed-Detector/0'
but I have the model uploaded
tried uploading a separate model and that seemed to try and download it at first but failed again.
/ModelFileDownloadSer( 7365): Need to download a new model.
D/ModelFileDownloadSer( 7365): Schedule a new downloading task: 64
D/ModelFileDownloadSer( 7365): Model downloaded successfully
D/ModelFileDownloadSer( 7365): Moving downloaded model from external storage to destination folder.
D/ModelFileDownloadSer( 7365): Moved the downloaded model to destination folder successfully: /data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Dog-Breeds
E/flutter ( 7365): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(Failed to load model, flutter_assets/File: '/data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Dog-Breeds/0', java.io.FileNotFoundException: flutter_assets/File: '/data/user/0/com.example.find_my_dog/no_backup/com.google.firebase.ml.custom.models/W0RFRkFVTFRd+MToyNjY1MDIxMjc4ODE6YW5kcm9pZDpjZjhiMjk0NjAwNWRjZGQ1ZjE5M2Q4/Dog-Breeds/0'
E/flutter ( 7365): at android.content.res.AssetManager.nativeOpenAssetFd(Native Method)
E/flutter ( 7365): at android.content.res.AssetManager.openFd(AssetManager.java:898)
E/flutter ( 7365): at sq.flutter.tflite.TflitePlugin.loadModel(TflitePlugin.java:210)
E/flutter ( 7365): at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:98)
E/flutter ( 7365): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter ( 7365): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/flutter ( 7365): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$DartMessenger(DartMessenger.java:319)
E/flutter ( 7365): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$TsixYUB5E6FpKhMtCSQVHKE89gQ.run(Unknown Source:12)
E/flutter ( 7365): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter ( 7365): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter ( 7365): at android.os.Looper.loop(Looper.java:223)
E/flutter ( 7365): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter ( 7365): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 7365): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter ( 7365): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 7365): , null)
everyone! I was developing e-commerce flutter app with doofinder APIs.
But I faced a thorny problem. I tried to get data from doofinder(it's just search service) API then present to screen. I added screen-shots.
Future<List<Product>> fetchProduct(query) async {
var response = await http.get(
Uri.parse(
'https://eu1-search.doofinder.com/5/search?hashid=30a5f&query=$query'),
// Send authorization headers to the backend.
headers: {'Authorization': 'c59dadc5d822ca2b134f170'},
);
if (response.statusCode == 200) {
// If the server did return a 200 OK response,
// then parse the JSON.
print(jsonDecode(response.body)['results'].toList().runtimeType);
return jsonDecode(response.body)['results'].toList().cast<List<Product>>();
} else {
// If the server did not return a 200 OK response,
// then throw an exception.
throw Exception('Failed to load album');
}
}
then,
onChanged: (_) => EasyDebounce.debounce(
'tFMemberController',
const Duration(milliseconds: 800),
() {
isSearchStarted =
textController!.text.isNotEmpty &&
textController!.text.trim().length > 0;
print('isSearchStarted $isSearchStarted');
if (isSearchStarted) {
print('${textController!.text.trim()}');
searchedProducts =
fetchProduct(textController!.text)
as List<Product>;
print(searchedProducts);
}
setState(() {});
},
),
And this is error log.
E/flutter ( 5295): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Future<List<Product>>' is not a subtype of type 'List<Product>' in type cast
E/flutter ( 5295): #0 _SearchPageState.build.<anonymous closure>.<anonymous closure> (package:s4s_mobileapp/search/page_search.dart:151:41)
E/flutter ( 5295): #1 EasyDebounce.debounce.<anonymous closure> (package:easy_debounce/easy_debounce.dart:44:22)
E/flutter ( 5295): #2 Timer._createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:18:15)
E/flutter ( 5295): #3 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
E/flutter ( 5295): #4 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
E/flutter ( 5295): #5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
E/flutter ( 5295):
I/flutter ( 5295): List<dynamic>
E/flutter ( 5295): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'CastList<dynamic, List<Product>>' is not a subtype of type 'FutureOr<List<Product>>'
E/flutter ( 5295): #0 fetchProduct (package:s4s_mobileapp/search/page_search.dart:41:58)
E/flutter ( 5295): <asynchronous suspension>
E/flutter ( 5295):
This makes me crazy.
I want you to take a closer look at the pictures below and find a suitable solution please.
Change
jsonDecode(response.body)['results'].toList().cast<List<Product>>();
to this:
jsonDecode(response.body)['results'].toList().cast<Product>();
The cast method already knows that you are working with lists and only wants to know the type of the elements, but not the type of the list itself.
EDIT: You also need to change:
searchedProducts = fetchProduct(textController!.text) as List<Product>;
to this:
searchedProducts = fetchProduct(textController!.text) as Future<List<Product>>;
You have to work with futures as your result is processed asynchronously. In the widget tree you have to use FutureBuilder which takes a future and builds your list as you want.
TFLite (movenet/multipose/lightning/tflite/float16)
I have loaded the model successfully but whenever I tried to run it... it just crashes the
app.
here is the code for loading and running the model:
Future loadModel() async {
try {
res = await Tflite.loadModel(
model:
"assets/lite-model_movenet_multipose_lightning_tflite_float16_1.tflite",
);
print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> model loaded: " + res.toString());
} catch (e) {
print(e);
print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Failed to load model.');
} }
Future poseNet(File image) async {
int startTime = new DateTime.now().millisecondsSinceEpoch;
var output = await Tflite.runPoseNetOnImage(
threshold: 0.7,
path: image.path,
numResults: 5,
nmsRadius: 15
);
print('>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> recognitions: ${output}');
setState(() {
_recognitions = output!;
});
int endTime = new DateTime.now().millisecondsSinceEpoch;
print(
">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Inference took ${endTime - startTime}ms ");}
here are the logs:
I/tflite (11904): Initialized TensorFlow Lite runtime.
I/flutter (11904): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> model loaded: success
W/System (11904): A resource failed to call close.
D/EGL_emulation(11904): eglCreateContext: 0xead612c0: maj 2 min 0 rcv 2
E/flutter (11904): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: PlatformException(Failed to run model, length=3; index=3, java.lang.ArrayIndexOutOfBoundsException: length=3; index=3
E/flutter (11904): at sq.flutter.tflite.TflitePlugin.initPoseNet(TflitePlugin.java:1262)
E/flutter (11904): at sq.flutter.tflite.TflitePlugin$RunPoseNet.<init>(TflitePlugin.java:1290)
E/flutter (11904): at sq.flutter.tflite.TflitePlugin.runPoseNetOnImage(TflitePlugin.java:1217)
E/flutter (11904): at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:179)
E/flutter (11904): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
E/flutter (11904): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:178)
E/flutter (11904): at io.flutter.embedding.engine.dart.DartMessenger.lambda$handleMessageFromDart$0$DartMessenger(DartMessenger.java:206)
E/flutter (11904): at io.flutter.embedding.engine.dart.-$$Lambda$DartMessenger$6ZD1MYkhaLxyPjtoFDxe45u43DI.run(Unknown Source:12)
E/flutter (11904): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter (11904): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter (11904): at android.os.Looper.loop(Looper.java:223)
E/flutter (11904): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter (11904): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (11904): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter (11904): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter (11904): , null)
E/flutter (11904): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (11904): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter (11904): <asynchronous suspension>
E/flutter (11904): #2 Tflite.runPoseNetOnImage (package:tflite/tflite.dart:350:12)
E/flutter (11904): <asynchronous suspension>
E/flutter (11904): #3 _SelectImageState.poseNet (package:model_ui/main/select_image.dart:105:18)
E/flutter (11904): <asynchronous suspension>
E/flutter (11904):
any help will be appreciated!
thank you!
I'm not an expert. But tflite plugin is out of date. You should try your luck with the tflite_flutter, which is also a bit outdated. But worked for me.
I'm facing this Exception while loading json from a .json file. complete Exception is :
E/flutter ( 4062): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception:
FormatException: Unexpected end of input (at character 1)
E/flutter ( 4062):
E/flutter ( 4062): ^
E/flutter ( 4062):
E/flutter ( 4062): #0 _ChunkedJsonParser.fail (dart:convert- patch/convert_patch.dart:1405:5)
E/flutter ( 4062): #1 _ChunkedJsonParser.close (dart:convert-patch/convert_patch.dart:523:7)
E/flutter ( 4062): #2 _parseJson (dart:convert-patch/convert_patch.dart:41:10)
E/flutter ( 4062): #3 JsonDecoder.convert (dart:convert/json.dart:506:36)
E/flutter ( 4062): #4 JsonCodec.decode (dart:convert/json.dart:157:41)
E/flutter ( 4062): #5 _HomePageState.loadJsonData.<anonymous closure>.<anonymous closure> (package:audio_player/presentation/pages/home_page.dart:22:35)
E/flutter ( 4062): #6 State.setState (package:flutter/src/widgets/framework.dart:1088:30)
E/flutter ( 4062): #7 _HomePageState.loadJsonData.<anonymous closure> (package:audio_player/presentation/pages/home_page.dart:20:27)
E/flutter ( 4062): #8 _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter ( 4062): #9 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter ( 4062): <asynchronous suspension>
E/flutter ( 4062): #10 _HomePageState.loadJsonData (package:audio_player/presentation/pages /home_page.dart:19:5)
E/flutter ( 4062): <asynchronous suspension>
My Json file path (lib/utils/json/popular_books.json) and code look like this:
[
{
"rating":"4.5",
"title":"sometitle",
"text":"sometext",
"img":"lib/utils/assets/image_1",
}
...
]
My images are in the same folder utils/assets. I'm loading json
List? popularBooks;
loadJsonData() async {
await DefaultAssetBundle.of(context).loadString("lib/utils/json/popular_books.json").then(
(loadedJson) => setState(
() {
popularBooks = json.decode(loadedJson);
},
),
);
}
#override
void initState() {
loadJsonData();
super.initState();
}
And I'm trying to load only the images in the page view :
PageView.builder(
itemCount: popularBooks==null?0:popularBooks!.length,
controller: _controller,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.only(right: 10),
height: 150,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
child: Image.asset("${popularBooks![index]["img"]}"),
);
},
),
And then this Format Exception If you have any fix please share it I'd me very thankful. <3
Your JSON is invalid. With a json validator you can spot the problem. In your JSON it is the following syntax error:
[
{
"rating":"4.5",
"title":"sometitle",
"text":"sometext",
"img":"lib/utils/assets/image_1", <-- This comma is the problem
}
]
I am posting a map on button click using provider, which calls Chopper service to post a map data to the server. It gives an error to the server which is something like this.
I/flutter ( 4801): Observatory listening on ************************************
E/flutter ( 4801): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Converting object to an encodable object failed: Instance of 'DateTime'
E/flutter ( 4801): #0 _JsonStringifier.writeObject (dart:convert/json.dart:688:7)
E/flutter ( 4801): #1 _JsonStringifier.writeMap (dart:convert/json.dart:769:7)
E/flutter ( 4801): #2 _JsonStringifier.writeJsonValue (dart:convert/json.dart:724:21)
E/flutter ( 4801): #3 _JsonStringifier.writeObject (dart:convert/json.dart:679:9)
E/flutter ( 4801): #4 _JsonStringStringifier.printOn (dart:convert/json.dart:877:17)
E/flutter ( 4801): #5 _JsonStringStringifier.stringify (dart:convert/json.dart:862:5)
E/flutter ( 4801): #6 JsonEncoder.convert (dart:convert/json.dart:262:30)
E/flutter ( 4801): #7 JsonCodec.encode (dart:convert/json.dart:172:45)
E/flutter ( 4801): #8 JsonConverter.encodeJson
E/flutter ( 4801): #9 JsonConverter.convertRequest
E/flutter ( 4801): #10 ChopperClient._encodeRequest
E/flutter ( 4801): #11 ChopperClient._handleRequestConverter
E/flutter ( 4801): #12 ChopperClient.send
E/flutter ( 4801): #13 _$PersonalPostingService.postPersonal
E/flutter ( 4801): #14 _FormState.build.<anonymous closure>.<anonymous closure>
E/flutter ( 4801): #15 _FormState.build.<anonymous closure>.<anonymous closure>
E/flutter ( 4801): #33 PlatformDispatcher._dispatchPointerDataPacket (dart:ui/platform_dispatcher.dart:282:7)
E/flutter ( 4801): #34 _dispatchPointerDataPacket (dart:ui/hooks.dart:96:31)
E/flutter ( 4801):
Exited (1)
This is where I am calling the function the body is a MAP of string, dynamic
child: RaisedButton(
onPressed: () async {
final form = _formKey.currentState;
if (form!.validate()) {
form.save();
showNotification();
await Provider.of<PersonalPostingService>(
context,
listen: false)
.postPersonal(data);
}
},
child: Text('Save'))),
The GET requests are working fine and are easily being displayed in a listview but the POST function is not working, just for the reference below is the chopper service for POST
#Post(path: 'http://157.......:8040/personal')
Future<Response> postPersonal(
#Body() Map<String, dynamic> body,
);