How can I serialize/store path object in flutter - flutter

I am kind of new to flutter and programming in general.
I am currently working on a drawing app where the user should be able to save the drawings and come back to them later on.
This means that I have to be able to store a path object locally.
https://api.flutter.dev/flutter/dart-ui/Path-class.html.
The problem I find is that I can't serialize the path object.
Here is a rejected PR where they wanted to implement a path iterator.
https://github.com/flutter/engine/pull/5632
and here is an open issue about similar problem.
https://github.com/flutter/flutter/issues/29125
I hope I explained my problem enough so that you understand my issue.
Do anyone have any idea of how I could serialize/store my path object?

I solved it by wrapping Path object in a new class that holds the Offsets separate.
It's not pretty but it works!

Related

Flutter Dartdoc: How to Document State Objects in Statefull Widgets?

This is a part of a project where i am building a clone of the Flickr App for educational purposes.
I am playing around for the first time with Dartdoc and Documentation concept in general, I managed to use Dartdoc and create a Doc folder with documentation for my project. However, for all my Stateful widgets, The widget itself has documented Properly however the state object (the object where I have my build methods, my initstate methods, and my state variables), I don't get any documentation for that, is that the default behavior or am I doing something wrong? I want to generate Documentation for this state object, the methods inside it, and the variables inside.
Apart From that, I am getting a couple of warnings, I will search further into those, and if can't manage to resolve them I will open a separate question.
Here is how I used Dartdoc:
Dartdoc command
End of Dartdoc command
Generated Doc
Generated Doc _ Methods
Forgive me if my question is stupid, it is my first time ever working with documentation :D
EDIT: A naive solution that I am doing, is that I moved most of my variables and methods to the widget object instead of my state object. Is this the right way to go about this?
Your State class is private (_FlickrCameraScreen), so it will not generate public documentation. If you want public documentation for it, you will need to rename it to FlickrCameraScreenState. You can give it a private constructor if you need to restrict creation to your FlickrCameraScreen widget.

How to clear/invalidate ambient cache on iOS app

When I update tilesets on mapbox, changes don't appear in the iOS app unless I re-install it. There is seemingly documentation on this here: https://docs.mapbox.com/ios/api/maps/5.2.0/Classes/MGLOfflineStorage.html#/c:objc(cs)MGLOfflineStorage(im)setMaximumAmbientCacheSize:withCompletionHandler: but I can't figure out how exactly to implement it. I don't have an MGLOfflineStorage object because I am not worried about offline map storage right now, I just want to refresh the cache in the app. There are good examples of how to do this in android, but not on iOS. Any help is appreciated (preferably in swift)
It appears to be correct to call the methods on the shared MGLOfflineStorage object. The method parameter should be a closure containing any code you want to execute upon completion.
MGLOfflineStorage.shared.invalidateAmbientCache { error in
print("Invalidated")
}
Naturally you should check the error in the usual 'safe' way.

How to get frame data in AppRTC iOS app for video modifications?

I am currently trying to make some modifications to the incoming WebRTC video stream in the AppRTC app for iOS in Swift (which in turn is based on this Objective-C version). To do so, I need access to the data which is stored in the frame objects of class RTCI420Frame (which is a basic class for the Objective-C implementation of libWebRTC). In particular, I need an array of bytes: [UInt8] and Size of the frames. This data is to be used for further processing & addition of some filters.
The problem is, all the operations on RTCVideoTrack / RTCEAGLVideoView are done under the hood of pre-compiled libWebRTC.a, it is compiled from the official WebRTC repository linked above and it's fairly complicated to get a custom build of it, so I'd prefer to go with the build available in the example iOS project; in my understanding it's supposed to have all the available functionality in it.
I was looking into RTCVideoChatViewController class and in particular, remoteView / remoteVideoTrack, but had no success in accessing the frames themselves, spent a lot of time researching the libWebRTC sources in official repo but still can't wrap my head around the problem of accessing the frames data for own manipulations with it. Would be glad for any help!
Just after posting the question I had a luck in finding the sneaky data!
You have to add the following property to RTCEAGLVideoView.h file:
#property(atomic, strong) RTCI420Frame* i420Frame;
In the original implementation file there is the i420Frame property but it wasn't exposed in the iOS project's header file for the class. Adding the property allows you to get view's current frame.
I'm still in search of a more elegant way of getting the stream data directly, without the need to look into remoteView contents, will update the answer once I find it.

Problems getting OSVR to initialise the HMD Display with Oculus DK2

I am using a Oculus DK2 (v0.8) and OSVR SDK. I'm having a problem getting the HMD to run/display anything.
The Oculus samples and the OSVR samples do work however, so the osvr_server seems to run fine.
My application itself renders a test scene just fine when not using a HMD.
I tried two approaches:
First, just creating a osvr context and creating a DisplayConfig object. This seems to work, but DisplayConfig::checkStartup() fails (I do this in a loop, calling update on the context when the checkStartup call is failing). I used the OpenGLSample.cpp as a guide for this
Second, I tried using a RenderManager, but the call to createRenderManager results in a crash within the RenderManager.dll. I get the same crash wether I create the graphics lib object myself or if I let the library create it.
I am quite stuck now, since the demos and examples do work, I have no idea where to look for the error on my side. Creating the context works, querying interfaces as well, but the crash with createRenderManager is beyond me.
Does anyone have any hints or ideas what the problem could possibly be?
Regards and thanks in advance
pettersson
RenderManager should not crash during open. There have been a couple of bug fixes recently to avoid that happening, and the latest RenderManager binaries, libraries and header files are available with the SDK download from http://osvr.github.io/using/ along with updated copies of the example programs.
When something goes wrong in RenderManager, it usually reports that to standard error. We're moving that to a logging interface, but for now it should show up on the console. Posting an output of that as an issue at https://github.com/sensics/OSVR-RenderManager/issues is a good way to let the developers know that there is a problem. Of course, providing the same sort of information you provided here will be helpful as well.

Using UnitySteer's SteerForPath in Unity3D

I tried asking this question on Unity Answers, but I don't seem to be getting an answer there, so I thought I'd try here
I'm trying to use the SteerForPath script in UnitySteer 2.5 with AngryAnt's Path 2.0 for a racing game, but I'm not sure how to: I can set up the waypoints in Path, but the SteerForPath script doesn't provide a way for a path to be linked to it in the inspector. Can anyone help me with how to link a waypoint path to UnitySteer's SteerForPath? It doesn't have to be AngryAnt's Path, but if it isn't it would be helpful if you could provide a tutorial or demo as to how to set up a waypoint path in that other system.
Thanks.
Are you referring to SteerForPath.cs in the Steering package from Arges-Systems? If so, you're better off using SteerForPathSimplified.cs
This version has a publicly available property for assigning a 'Path'. Though the Arges-Systems author does state (halfway down in comments) that his SteerForPathSimplified.cs is not necessarily designed to work with AngryAnt's code, but you should be able to quickly modify it to suit your needs.