КОМЕНТАРІ •

  • @0dyss3us51
    @0dyss3us51 4 роки тому +2

    Love how you put location on the vid as well, good vid!

  • @AnubhavAnand884
    @AnubhavAnand884 4 роки тому

    Love the way you teach. Please make more and more videos.

    • @FilledStacks
      @FilledStacks 4 роки тому

      Thank you. I'll try my best to keep making videos.

  • @Mark-mo4bo
    @Mark-mo4bo 4 роки тому

    All your material and website is REALLY exceptional. The video is breakneck speed for people like me who are just starting out, but the step by step on the website is totally spot on to recap when I get lost. Other instructional vids go down unrealistic 'non real world' examples and teach poor design habits. However, just by watching your videos I've taken a step back from learning the small picture stuff and am now focused on understanding bigger picture design concepts. I'll fill the knowledge gaps in slowly as I go. Thanks so much for the terrific quality. You've helped a lot.

    • @FilledStacks
      @FilledStacks 4 роки тому

      Mark! This is a very great comment and I really appreciate it! Thank you for taking the time to write it, I'm very happy I can help you with that. If you want to understand why I write code in a certain way I can give you some things to read.
      Number one. SOLID principles, single responsibility is the reason I create services and use MvvM as my architecture.
      Number 2: The pragmatic programmer: From journey man to master. Ideas and thoughts on building maintainable more robust software
      Number 3: Clean code.
      That should put you right where you want to be. And then any talk by Robert C Martin or Martin Fowler.

    • @Mark-mo4bo
      @Mark-mo4bo 4 роки тому

      @@FilledStacks Excellent thanks mate. I'll check those guys out. I already started to check up on SOLID after you mentioned single responsibility on the GPS website blurb. Found a good series on youtube, albeit in C#. Back-tracing the GPS plugin to understand what/how you were doing after I manually duplicated the code taught me more about design than 10 hours of video watching endless int/var/class bs. Even to an amateur eye, Flutter has got to be the last framework in the world you'd want to be bad at keeping clean! Thanks again man.

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      @@Mark-mo4bo Aweeesome!!! you're very welcome man I'll always put principles over the topic because that's the main thing that keeps my code maintainable. welcome to the club, you'll learn a lot. please comment and let me know if anything could be done better in my videos or you have suggestions for me.

    • @Mark-mo4bo
      @Mark-mo4bo 4 роки тому

      @@FilledStacks Hey Dane just throwing it out there.. If you're interested and had the time, how many rand an hour would you charge for a bit of 1 on 1 programming mentoring / screen sharing? There's always a big 'but why' gap with programming between the simple stuff and serious stuff where the serious stuff becomes too much copy and paste without understanding the mechanisms (and thus being able to apply to other concepts). Let me know if you're interested mate. Cheers, Mark.

    • @FilledStacks
      @FilledStacks 4 роки тому

      @@Mark-mo4bo Hey Mark. that's very true, I try to explain most of what i do but i can't always say everything in every video so it makes it harder to get the message across. especially if you don't watch all the previous videos. On your request, I currently won't have time for that and I also wouldn't feel comfortable charging an individual the amount that i would want in order to do it. Companies pay it and I'm fine with it, but not individuals. If you want to understand why I do things in code the way i do i recommend learning the SOLID principles (especially the single responsibility principle) and reading clean code. from there you can read a book called Pragmatic Programmer : From journeyman to master. And then watch as much robert c martin and brett fowler talks as you can 🤓 It'll give you the idea behind my mindset, why i so certain things and Why i prefer it that way as well.

  • @buck-johnson
    @buck-johnson 2 роки тому

    Excellent video, I really like the pace.

    • @FilledStacks
      @FilledStacks 2 роки тому

      Thank you. I'm happy it's useful after all this time :D

  • @kbyo2006
    @kbyo2006 4 роки тому

    Great Channel!!! Thanks for this tutorial 👍

    • @FilledStacks
      @FilledStacks 4 роки тому

      Thank you, and thanks for watching ☺️

  • @muhamadkhuram1261
    @muhamadkhuram1261 3 роки тому

    I was finding this solution from a week
    ... Thanks man...

  • @mruduladdipalli5417
    @mruduladdipalli5417 3 роки тому

    Woow great explaination!!!!

    • @FilledStacks
      @FilledStacks 3 роки тому

      Awesome! I'm happy it was helpful.

  • @gabo_xp
    @gabo_xp 4 роки тому +1

    great !! thank you !!

  • @astra5877
    @astra5877 2 роки тому

    really useful thanks!!

    • @FilledStacks
      @FilledStacks 2 роки тому +1

      You're very welcome and thanks for watching

  • @P00LAR521
    @P00LAR521 4 роки тому

    You're the greatest, I was looking a vieotutorial and the yours is the best.

    • @FilledStacks
      @FilledStacks 4 роки тому

      It makes me very happy to hear that! Thank you so much for watching and the positive feedback.

  • @eddiekamau6601
    @eddiekamau6601 4 роки тому +1

    Great tutorial. No need to use Scaffold, you can use any Widget with Material Theme, such Material widget

  • @yusufayobami8420
    @yusufayobami8420 4 роки тому

    Thanks God bless you

  • @GomzeYT
    @GomzeYT 4 роки тому

    Great tutorial!
    Could you show us how to make a qr code scanner?
    There are severel packages out there but they are not working or way to complex to use

    • @FilledStacks
      @FilledStacks 4 роки тому

      That's a very specific use case so won't go into that unfortunately. I want to focus more on broader concepts and not specific implementations.

  • @ryandooley4819
    @ryandooley4819 4 роки тому +1

    im getting Widget Function(BuildContext)' can't be assigned to the parameter type 'Widget Function(BuildContext, Widget) for StreamProvider(
    builder: (context) => LocationService().locationStream,

    • @FilledStacks
      @FilledStacks 4 роки тому

      You're supplying the wrong type to the function. I think the name has changed to create for that property as well.

    • @ryandooley4819
      @ryandooley4819 4 роки тому +6

      @@FilledStacks figured it out, turns out things have changed since you made this app, StreamProvider does not require builder.
      return StreamProvider.value(
      initialData: UserLocation(),
      value: LocationService().locationStream,
      child: MaterialApp(title: 'Flutter Demo', home: HomeView()));

    • @FilledStacks
      @FilledStacks 4 роки тому

      @@ryandooley4819 Good to know you figured it out. Builder has been renamed to create, the .value constructor won't dispose your stream but you can use it for providing a stream that you'll re-use. If that's what you're looking to do

  • @rajkiranast9398
    @rajkiranast9398 3 роки тому +1

    nice tutorial... love the way you explained , what if application is in background or removed from background

    • @FilledStacks
      @FilledStacks 3 роки тому

      Thank you. If the app is in the background it'll work. If it's removed from the background the service will stop. It can be restarted by your app but I have a feeling with new OS's rolling out that's going to become even more difficult.

  • @PrateekAher
    @PrateekAher 3 роки тому

    I did as you instructed in the video. At 7:13 I found that 'builder' isn't working the same way with latest version of provider. With some reading on provider's page on pub.dev, I replaced it with:
    create: (context) => LocationService().locationStream,
    This wiped the error off my screen. Can you check and confirm if this will work the same?

    • @FilledStacks
      @FilledStacks 3 роки тому

      Hey. yes. Provider updated the builder property name to create.

  • @juliosena6406
    @juliosena6406 4 роки тому +1

    Thanks a lot!! I would like to show a video with "Theme dark and Theme Light".

    • @FilledStacks
      @FilledStacks 4 роки тому

      There are a few good ones. Check on resocoder I think he created one. If there's not let me know and I'll plan one.

  • @marybelarenas64
    @marybelarenas64 4 роки тому

    If I wanted to make an app that doesn’t transfer location data while the person is driving, would I then redo this model but take out the stream controller ?

    • @FilledStacks
      @FilledStacks 4 роки тому

      The scenario doesn't change the implementation in this case. If you don't want updates in real time don't listen to the stream. Request the update from the service when you need it and use it where it's required.

  • @srineeshsalur524
    @srineeshsalur524 4 роки тому +1

    how to draw live location using flutter. I am currently working on a fitness app wherein we track the user location in the background. I would like to know how to draw the location traveled by the user. Can anybody please help me with this problem.
    Thank you for reading.

    • @FilledStacks
      @FilledStacks 4 роки тому

      On each update you get from the location changed store the coordinates in a list of coordinates then draw curved lines between them. Or if you can map it to an existing path that would be better. Then you can approximate the path/roads taken and highlight that on your map

    • @nikitalotlikar1954
      @nikitalotlikar1954 4 роки тому

      hey have found the solution to this problem?

  • @22pureshooter
    @22pureshooter 4 роки тому

    How would you use the location service along with a view model for a mapview?

    • @FilledStacks
      @FilledStacks 4 роки тому

      I'd get the location service in the ViewModel and register the listener in an initialise function called from onModelReady. That listener would update a private location position and call notifyListeners. In the view when my builder is called I'd remove the current marker, create a new one with the new position and place it on the map. Or update the old marker if I kept a reference.

  • @alicemueller4914
    @alicemueller4914 4 роки тому +1

    Can you produce a video that shows how this concept can be applied to live tracking like the uber taxi type?
    Thank you and Great video btw

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      Thanks. It won't be a long video. All you do is inject your service in the viewmodel or block that controls your map position. subscribe to the location stream and in the listen handler update your position and refresh the state.

  • @ClickBooom
    @ClickBooom 4 роки тому

    Awesome video! Is there a way to extract details of an address from the latitude and longitude? Say you want to find a city or an area. How could this be done and updated? Cheers!

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      Thanks. Yes there is, you can use the Google places package and get the closes place using the lat/long then get the city and other details from that.

  •  4 роки тому

    is possible call the latitude to a variable to save on database? how do i call the stream in another class?

    • @FilledStacks
      @FilledStacks 4 роки тому

      It is possble. You call the stream in another class the same way you called it in this class where it's being called now.

  • @sreejithm3213
    @sreejithm3213 4 роки тому

    i have this error
    I/flutter ( 3664): The following NoSuchMethodError was thrown building HomeView(dirty, dependencies:
    I/flutter ( 3664): [InheritedProvider]):
    I/flutter ( 3664): The getter 'latitude' was called on null.
    I/flutter ( 3664): Receiver: null
    I/flutter ( 3664): Tried calling: latitude
    I/flutter ( 3664): User-created ancestor of the error-causing widget was:
    I/flutter ( 3664): MaterialApp
    package:mob_loc/main.dart:15
    I/flutter ( 3664): When the exception was thrown, this was the stack:

    • @FilledStacks
      @FilledStacks 4 роки тому

      Make sure you supply a stream provider with an initial value. Or guard against the null for your data

  • @beyondbuks4828
    @beyondbuks4828 4 роки тому +1

    Hey, great video but when implementing i am having a NoSuchMethodError: invalid member on null: 'latitude' before giving permission in flutter web. Please help. Thank you in advance

    • @FilledStacks
      @FilledStacks 4 роки тому

      Thank you, sounds like you're trying to check latitude before there's any value. Check if it's null before using it

    • @beyondbuks4828
      @beyondbuks4828 4 роки тому

      Thank you for the reply. Yes a null check has solved the problem.

    • @beyondbuks4828
      @beyondbuks4828 3 роки тому

      Hey, what if the user rejects the location. Currently, I am trying to setup location boundaries for the WebApp. I am using a combination of Streams(Mainly inspired by your network connectivity and Streams tutorial) and this tutorial.
      Problem: If the user rejects the location I currently have no way to get permission again. Also even if the user closes the tab my service is still left out at the denial stage and it does not change.
      HOW I AM Implementing it?
      The Client mainly sends the requests in the web application.
      Here is the setup:
      enum ServiceLocation { present, absent }
      StreamController locationServiceController =
      StreamController.broadcast();
      And then using your tutorial and a calculation that gives us the serviceable area by using haversine formula(ref link: blanq.io/haversineFormula) and an if condition comparing the values returned from the calculation and the boundary set.
      Solutions i tried?
      I added gettingLocation for requesting the location again but i am getting a obejct error.
      class LocationTracking {
      Future gettingLocation() {
      try {
      location.requestPermission().then((granted) {
      if (granted == PermissionStatus.granted) {
      location.onLocationChanged.listen((changedLocationData) {
      if (changedLocationData != null) {
      double distance = calculateDistance(
      lat2: changedLocationData.latitude,
      lon2: changedLocationData.longitude,
      lat1:
      17.5169, //These are hardcoded values of restaurent given here.
      lon1: 78.3428);
      //I am currently setting the location boundary to be 120km here.
      //Should check on real devices for sure before confirming.
      if (distance < 120) {
      return ServiceLocation.present;
      } else if (distance > 120) {
      return ServiceLocation.absent;
      }
      }
      });
      } else if (granted == PermissionStatus.denied) {
      return ServiceLocation.absent;
      } else if (granted == PermissionStatus.deniedForever) {
      return ServiceLocation.absent;
      }
      });
      } catch (error) {
      print(error);
      }}}
      here is my call:
      FlatButton(
      onPressed: () async {
      // Location location = Location();
      var t = await LocationTracking()
      .gettingLocation()
      .then((value) => locationServiceController.add(value));
      // if()
      // print(t);
      // locationServiceController.add(t);
      },
      child: Text("Try again"))
      Thank you for your work

  • @Sampelmind81
    @Sampelmind81 3 роки тому

    Hello and thank you for the well explained video! I need your advice, for a project i need the most accurate approach of getting the user location information. i followed your instruction and recognized later in my car a little delay getting updated information. Is it possible in flutter to combine gps with network information? Thank you!

    • @FilledStacks
      @FilledStacks 3 роки тому

      Hello, you're welcome and thank you for watching. The location is broadcast I think every 5 m of difference. The package contains some accuracy settings that I can't think of right now. If you want to be more accurate you won't get any "real-time" updates. The best thing would be to check how fast you're moving and manually check the location to broadcast. I can't think it through right now but there should be some things you can du using the accelerometer in combination with the gps.

    • @Sampelmind81
      @Sampelmind81 3 роки тому

      @@FilledStacks Ok thank you very much for your advice!

    • @Sampelmind81
      @Sampelmind81 3 роки тому

      One more question i facing the Problem that requesting the device Position freezing the screen so i believe to work with an backgroundservice?

  • @tomnijs2639
    @tomnijs2639 3 роки тому

    Thank you for this tutorial. Since you're asking for 'NSLocationAlwaysUsageDescription', will the location updates keep coming as long as the app is in memory?

  • @williamsgobi8723
    @williamsgobi8723 3 роки тому

    Hello! First of all, thank you for this video, it helped me a lot with my app. However, I need one information, how can I get the location for each 30 seconds? I need just one latitude and longitude in this time, but, using the onLocationChanged, I receive many locations in just one second, I tryied already to change settings but I still receive many locations, I thought to use a dart function to run all the time just calling the getLocation() but I don't know how can I make it. Could you help me?

    • @FilledStacks
      @FilledStacks 3 роки тому

      Hey William, I'm happy to have helped. You can do exactly as you said. Create a timer and onTick you can call getLocation and broadcast that.

    • @beyondbuks4828
      @beyondbuks4828 3 роки тому

      how about trying using async await in the function using Future.delayed(seconds: 30) and then adding location data to the stream.

  • @SunilparajuliKenshin
    @SunilparajuliKenshin 2 роки тому

    Hi bro , any solution on event handling when the user denies the location access and app crashes... exception block didn't work in permission

    • @FilledStacks
      @FilledStacks 2 роки тому

      When they deny you should skip all location logic

  • @adityalakshminarayanan6277
    @adityalakshminarayanan6277 4 роки тому

    Hi,
    Amazing tutorial.
    But I'm getting an error 'uri_does_not_exist'
    for user_location.dart
    Is there any solution?

    • @FilledStacks
      @FilledStacks 4 роки тому

      Thank you. I don't know. I've never seen that error. You'll have to debug to figure out what's wrong.

  • @santosvision
    @santosvision Рік тому

    hello buddy, first of all thank you for this beautiful tutorial... quick question, when requesting the persmission the granted value has to be a bool in order to work in the following IF statement. any quick tip how to go around it?
    thanks again

    • @FilledStacks
      @FilledStacks Рік тому +1

      Get around what? Not using a boolean? If so then you can use the status of the permission and compare it to the status that you want it to be.

    • @santosvision
      @santosvision Рік тому

      @@FilledStacks thank you so much, i got it working.

  • @ViralVideoMalayalam
    @ViralVideoMalayalam 4 роки тому

    Hi,
    nice video, pls let me know if you are available for custom development, we need to build a simple location tracker for multiple users, similar to this . thanks

    • @FilledStacks
      @FilledStacks 4 роки тому

      Yes, we are available. You can email me at dane[AT]filledstacks.com and discuss further

  • @berthojoris
    @berthojoris 4 роки тому +1

    Thanks...How about next tutorial is show lat long in google map based on this tutorial?

    • @FilledStacks
      @FilledStacks 4 роки тому +3

      Maybe. I have another video planned but that's a good idea.

    • @adilkhan8993
      @adilkhan8993 4 роки тому

      @@FilledStacks please make video on this

  • @ShivamKaushik14
    @ShivamKaushik14 4 роки тому

    How can you achieve this using StreamBuilder ? and how to create periodic streams ??

    • @FilledStacks
      @FilledStacks 4 роки тому

      Instead of using Provider.of with the stream supply the stream to the stream builder and it should have the same effect

  • @entertainmentknowledge7601
    @entertainmentknowledge7601 4 роки тому

    I wants to get location even my app is closed can you please suggest me that how i can implement that? TIA

    • @FilledStacks
      @FilledStacks 4 роки тому

      Register a background handler and start the location tracking on a service for Android.

  • @virreeeee
    @virreeeee 2 роки тому

    Super great video. How do you handle if user denies permission. Can we somehow execute the streamprovider thing after listening to the status when it has been changed to authorzed after user initially denied permission?

    • @FilledStacks
      @FilledStacks 2 роки тому

      Thank you 😊 If user denies we don't execute anything. Not much we can do about that.
      This will run at statrtup so if the uset has changed the permissions it'll simply activate.

  • @santosvision
    @santosvision Рік тому

    I have everything working properly, however when the map is loading i get this error for 2 seconds:
    Error: the widget full screen map tried to read provider but the matching provider returned null. to fix the error, consider changing provider to provider.
    I've tried the suggested method and it doesn't work. I have also exhausted almost all the "solution" on stack overflow n no luck.
    Again, i am able to get the continuous update, but before the UI is showing, That Red Error Screen pops up and then goes away after 2 seconds and everything works fine afterwards.
    Any wizard willing to help this noob? Thank you so much in advance guys.

    • @FilledStacks
      @FilledStacks Рік тому

      Happy to hear this still works after so many years. You should provide an initial value in your provider with an empty UserLocation.

  • @ssquare1
    @ssquare1 4 роки тому

    How to get current location with google maps so that I can send to any user?

    • @FilledStacks
      @FilledStacks 4 роки тому

      You don't get the current location with google maps you get it with the location package. If you want to open it in google maps for the user then use the google app's uri scheme to open the location using an intent on android and openWebPage on ios.

  • @kirill4531
    @kirill4531 4 роки тому

    The interesting part here is that you used StreamProvider instead of providing the whole Service (like what we do in MVVM approach).
    So in MVVM we create a ViewModel which extends ChangeNotifier and when we have a change - we call notifyListeners() method.
    But approach with StreamProvider - is a bit different. Here we can have multiple streams in one ViewModel sending data to UI, we don't even need to extend ChangeNotifier.
    Could you please elaborate on the difference of these two approaches (even though we use Provider package in both of them) and when should we use the first (updating UI with the entire our ViewModel) and the second (having multiple streams in our "ViewModel", even though it may not extend ChangeNotifier)
    Thank you

    • @FilledStacks
      @FilledStacks 4 роки тому +2

      Yes you're right. I mention in the tutorial that I usually have a viewmodel that I use my services with. If you watch my provider v3 architecture you see that I have something called UIproviders, or something along those lines. This is for information that is required on almost every view. I've since moved that into a base viewmodel instead but at the time i liked the shorthand of the stream provider, managing the stream itself and making sure it's unsubscribed. It's just another way of doing it. Either you put data that will be required on every view in a base viewmodel and write duplicate code everywhere to access it. Or you provide it a stream provider once and access if using the duplicate code of the Provider.of call. Both has the same result, it's up to you which one to use. To keep consistent I'd say go the viewmodel route and have a base class with the shared value.

    • @kirill4531
      @kirill4531 4 роки тому

      @@FilledStacks Thank you Dane

  • @superCharged24
    @superCharged24 4 роки тому

    hello great tutorial ! but please i am getting an error on my main.dart file, after writing builder: (context) => LocationService().locationStream, I get this error:>>>> The argument type 'Widget Function(BuildContext)' can't be assigned to the parameter type 'Widget Function(BuildContext, Widget)'

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      I'll answer the question but you should try and understand these error messages otherwise your development experience won't be great. The answer is to put another parameter in your anonymous function (context, child) => LocationService().locationStream.
      The reason for that is simple, as explained in the error message. Lets break it down how I read error messages.
      The argument type 'Widget Function(BuildContext)' can't be assigned to the parameter type 'Widget Function(BuildContext, Widget)'
      So currently you're giving the builder a function that takes a BuildContext and returns something like this.
      builder: (context) => LocationService().locationStream
      It's telling you that that's not the same as a function that takes the BuildContext and a Widget and returns a widget. Which is true.
      So if your function is doing this builder: (BuildContext context) => LocationService().locationStream and the only thing they're asking is to supply another parameter in your anonymous function then you should simply add another parameter in your anonymous function like this.
      builder: (BuildContext context, Widget child) => LocationService().locationStream

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      Understanding these things early will make it so you can stand on your own feet as a developer. These aren't even development problems, it's compiler problems. Those should always be solvable by you. You can navigate to any definition in Flutter code and see what it expects. It's open source. You should make use of that.

    • @superCharged24
      @superCharged24 4 роки тому

      Yes you are right, I am only new to all this, I am just trying to build something to help me learn fast

    • @superCharged24
      @superCharged24 4 роки тому

      Thank you so much for your response 👍

  • @psbook2363
    @psbook2363 4 роки тому

    sir please help me how to update location on sever with http in background

    • @FilledStacks
      @FilledStacks 4 роки тому

      When the location is broadcast from your service like in the video call http.post('yourUrl', body: {'lat': yourLat, 'long': yourLong}); That should do it.

  • @pasindupriyashan385
    @pasindupriyashan385 4 роки тому

    thnx a lot. i need to know how to stop the location updates on press the button

    • @FilledStacks
      @FilledStacks 4 роки тому

      You're welcome :) Cancel the stream subscription you're listening to should stop all updates

  • @hyy1856
    @hyy1856 3 роки тому

    sir please i can't see it work when turn off the screen. app still work foreground

    • @FilledStacks
      @FilledStacks 3 роки тому

      Yeah, if you lock the screen you can't see what's on it :) ... You should use a background service if you want the same functionality to run when the app is in the background.

  • @RomanLeBg
    @RomanLeBg 4 роки тому

    Is it possible by subscribing to the location change we get an error in case the user desactivated the location services to display a message and when it reactive it the message dissapear ? Because when I try to do that I just don't get any location update instead of an error

    • @FilledStacks
      @FilledStacks 4 роки тому

      It's possible from the plugin stand point but you can do that within the service. You'll have to use a timer to check availability of the service. When the user has not given permission you send out your error. When there's permission you cancel the timer , send out a "Permission granted"and then start emitting your actual location.

    • @RomanLeBg
      @RomanLeBg 4 роки тому

      @@FilledStacks Oh okay thank you for your response I didn't thought you would reply this quickly. So that mean I need to constantly check for the Location enabled/granted and also use the Stream to update the map ? I thought the stream from Geolocation (and not geolocator) was a Timer that check everything because the the stream return every error possible pub.dev/packages/geolocation#handle-location-result but I never got any except if I start the app without having the GPS activated. I will try to check if the location is enabled every seconds or more but since the app should run as a service it will possibly eat more battery

    • @FilledStacks
      @FilledStacks 4 роки тому

      @@RomanLeBg Yeah, once you get the permission accepted you should stop the timer as mentioned above. It'll only run when you don't have permission for location. If they disbale the permission you can listen for that and start the timer again. This way it won't take more battery than the normal implementation since it's a map value check to see which permissions are enabled.

    • @RomanLeBg
      @RomanLeBg 4 роки тому

      @@FilledStacks I mean when I listen to the location update I don't have any error when I desactivate the GPS in android, I just don't have update maybe I need to create a shared value between the stream and a timer that run every seconds so for every location update I set the value to 10 and the timer decrease it by one every seconds so if I don't have any update for 10 seconds I check if the service is enabled but its a hacky solution. I tried the location library but I don't have any error too. I tried searching some app that needs the GPS but I haven't found a solution yet. Do you have any example or stuff like that ?

    • @FilledStacks
      @FilledStacks 4 роки тому

      @@RomanLeBg I don't. I'd probably do what you're suggesting with checking if there's been no updates for 10 seconds.

  • @nataliapalweski2072
    @nataliapalweski2072 4 роки тому

    Is that background service? if app is closed will it be able to send location to API.. just like background services in native works?

    • @FilledStacks
      @FilledStacks 4 роки тому

      If the app is completely closed then no, but you can spawn an background isolate that can react to the location and trigger an api call. There's a good tutorial for it on medium that uses beacons.

    • @niclas2837
      @niclas2837 4 роки тому

      @@FilledStacks Are you saying that the streamcontroller will continue to receive location updates when the app is minimized (with the screen off)?

    • @FilledStacks
      @FilledStacks 4 роки тому

      @@niclas2837 It could. Otherwise you can use a background isolate to achieve that if it's not currently doing it.

  • @emmanuelbonke7374
    @emmanuelbonke7374 4 роки тому

    Great Tutorial....
    Can you add the implementation using markers and google maps ?

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      Thanks. I might add that next year some time. All you have to do is subscribe to the stream and updste your localarker position in the listen callback function.

    • @adilkhan8993
      @adilkhan8993 4 роки тому

      @@FilledStacks can you give us a video on it

  • @MrDacheetz
    @MrDacheetz 2 роки тому

    Awesome tutorial, thanks! One question before I code it up, if the screen turns black from inactivity, does this service continue to get your location or does it wait to be "awoken"?

    • @FilledStacks
      @FilledStacks 2 роки тому +1

      Thank you, and good question. It'll continue running until the app is closed or made inactive by the OS.

    • @MrDacheetz
      @MrDacheetz 2 роки тому

      @@FilledStacks Thanks. Do u know a way to passively get ur location while the app is inactive?

    • @FilledStacks
      @FilledStacks 2 роки тому

      @@MrDacheetz Yes, you have to use a Background service in Android and a Long running action in ios. There's packages for that. You can get it once every 30 minutes I think. I think that's currently the limit. At some point they will probably make it impossible. It's been getting harder and harder with every release to do background work.

    • @MrDacheetz
      @MrDacheetz 2 роки тому

      @@FilledStacks Thank you, this is not good news at all...game ruined :/

    • @FilledStacks
      @FilledStacks 2 роки тому +1

      @@MrDacheetz Read up on Android Sticky Background services and iOS long running processes and see if you can use it to you advantage.

  • @ciimaofficial7252
    @ciimaofficial7252 4 роки тому +1

    Can this be used for multiple users tracking?

    • @FilledStacks
      @FilledStacks 4 роки тому

      Yes, it's the same things. just send a user model with an id and update positions based on that id.

    • @ciimaofficial7252
      @ciimaofficial7252 4 роки тому

      @@FilledStacks thanks for replying. I want to use it on my buddypress website, will it work?

  • @cristhianjavierdelgadofons739
    @cristhianjavierdelgadofons739 4 роки тому

    i can't use classpath 'com.android.tools.build:gradle:3.3.0'

    • @FilledStacks
      @FilledStacks 4 роки тому

      Then you should probably use a later or older version. Whichever you need to. If you can't upgrade to Android X the go back to a version of the plugin where it didn't use AndroidX

  • @adarshgabani1906
    @adarshgabani1906 3 роки тому

    Hey how can I turn on GPS if it's turned off by default. By giving permission It just asking for permission. Not turn it on.

    • @FilledStacks
      @FilledStacks 3 роки тому

      You can't do that unfortunately. You're not allowed to override any option that the user has set out of their own free will. That would introduce a lot of unwanted behaviour from certain apps that you don't want to use the GPS with.

    • @adarshgabani1906
      @adarshgabani1906 3 роки тому

      @@FilledStacks I'm talking about its like google maps. If our gps is turned off and we open Google maps thn it gives a Alert dialogue where we click "yes" thn it turn on gps for us

  • @RamanaPtr
    @RamanaPtr 3 роки тому

    Thank you so much! It helped me.. btw, in the end of the video, your video thumbnail make it closed, and i want to see the result 😭

    • @FilledStacks
      @FilledStacks 3 роки тому

      Thanks man, it's my pleasure to share it. haha, I'm sorry about that. It's not very interesting, just some text updating :)

  • @madhusudhanr3527
    @madhusudhanr3527 4 роки тому

    You are awesome!! Thanks for the videos. I'm learning a lot. I have a topic to suggest bottom navigation bar using routes. Do you already have one?

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      Thanks man. I appreciate the feedback. I don't have a topic for that but it's a good one. Thanks for the suggestion.

  • @kallaviruthan9023
    @kallaviruthan9023 3 роки тому

    Does it work when the app is not open.
    If not how to do that.

    • @FilledStacks
      @FilledStacks 3 роки тому

      Yeah. you can just supply a backroungd handler

  • @brentusa7517
    @brentusa7517 3 роки тому

    Looking to build a new app for our crisis center...how do I contact you?

    • @FilledStacks
      @FilledStacks 3 роки тому

      You can email me at dane {AT} filledstacks . com

  • @bhushan2k
    @bhushan2k 3 роки тому

    how to get location when app is closed or cleared from recents?

    • @FilledStacks
      @FilledStacks 3 роки тому

      Us the background location handler. The OS won't allow that unless it's been allowed by user, even then you can get it every 50m I think.

  • @lahiruferreira2586
    @lahiruferreira2586 2 роки тому

    is this possible to use in indoor navigation?

    • @FilledStacks
      @FilledStacks 2 роки тому

      That's device dependant. If your phone sends updates in doors then it'll work.

  • @souravmenonvkp7538
    @souravmenonvkp7538 3 роки тому

    how i will add change settings onlocationupdate

  • @sajidahmed6350
    @sajidahmed6350 4 роки тому

    Is it possible to get device velocity with location class???

    • @FilledStacks
      @FilledStacks 4 роки тому

      Yes, calculate the delta from previous location update to latest one and make sure it refreshes with the smallest amount you can. I think every 10 meters or every 5 is possible.

    • @sajidahmed6350
      @sajidahmed6350 4 роки тому

      @@FilledStacks does it update location when app is killed or in background??

    • @FilledStacks
      @FilledStacks 4 роки тому

      you can implementn it to do that.

    • @kushalpillay2677
      @kushalpillay2677 4 роки тому

      @@FilledStacks How could we let this run in the background?

  • @reemosman2207
    @reemosman2207 4 роки тому

    thanks man it's really a very good video and amazing job
    but cat you give me the link of the provider.dart or what exactly in side it
    i searched in google provider github repo and couldn't find any thing :(

    • @FilledStacks
      @FilledStacks 4 роки тому

      Provider is a package. Install it through your pubspec.

  • @madhusudhanr3527
    @madhusudhanr3527 4 роки тому +1

    If anyone runs into problem with AndroidX migration please follow this guide.
    flutter.dev/docs/development/packages-and-plugins/androidx-compatibility

    • @FilledStacks
      @FilledStacks 4 роки тому

      Yeah. Android x gives some weird problems. Thanks for sharing the link

  • @chinmayagarnaik6458
    @chinmayagarnaik6458 4 роки тому

    Please can you make a video on how to retrieve double value or geo point from firebase

    • @FilledStacks
      @FilledStacks 4 роки тому

      I won't make a video for something so small. Store it in a map with key lat and long and then get it out of the map on device

    • @chinmayagarnaik6458
      @chinmayagarnaik6458 4 роки тому

      @@FilledStacks I stored it in firebase but when I am trying to retrieve it in my device it say double value is not a string.
      I tried to retrieve double value but I can't
      Can you tell me how to retrieve double value from firebase or geo point
      Or can you make a small helping clip.

    • @FilledStacks
      @FilledStacks 4 роки тому

      @@chinmayagarnaik6458 That makes sense. You probably have to cast it to what you expect it to be.

  • @devindersingh5399
    @devindersingh5399 4 роки тому

    when i minimize the app , it wont getting the location

    • @FilledStacks
      @FilledStacks 4 роки тому

      You will.

    • @devindersingh5399
      @devindersingh5399 4 роки тому

      @@FilledStacks how can i get location update continous when app is in background

  • @satyamedavarapu1157
    @satyamedavarapu1157 8 місяців тому

    How to stop the service of location package

    • @FilledStacks
      @FilledStacks 8 місяців тому

      Create a function called stop on the service and call that where you need to call it.

  • @moahaimen
    @moahaimen 4 роки тому

    i didnt see the result there is a video on the screen

  • @ksk235
    @ksk235 4 роки тому

    Great Tutorial man :) Will this work in the background when user turns the screen off??

    • @FilledStacks
      @FilledStacks 4 роки тому +2

      Thanks 😁 When the user turns the screen off, yes, when the user closes the app completely, no. You'll need to add that functionality.

    • @ksk235
      @ksk235 4 роки тому

      FilledStacks wow thanks. I could live with this working on background when user turns screen off. Previously thought I need to write native code for it to work in background. Gotta try this out

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      @@ksk235 Yeah, unless the OS kills the app it will continue running in the background.

    • @ksk235
      @ksk235 4 роки тому

      hi, i've tried to see if it works in the background. It doesn't. If I turn off the screen or hit home button to minimize the app the service just stops. I can be sure of that because the location icon also disappears from the task bar as soon as I go to home screen without closing the app. Also in my implementation i've set it to save the updated lat & lng in a backend server whenever I get new location update, the app also stops saving the location in the server when i go to home screen or turn the screen off. I guess there's no way to run it in the background other than writing OS specific code for both android and IOS.

    • @amigoface
      @amigoface 4 роки тому

      @@FilledStacks this is exactly what i am looking for .
      i mean when the app is completely closed , for example after device restart .
      something like windows services ...
      any idea or hint on how this can be implemented please ?
      really appreciate your help on this one .
      thanks anyway for this excellent and "to the point" tutorial

  • @premkanojiya4657
    @premkanojiya4657 4 роки тому

    can u give the provider.dart code

    • @FilledStacks
      @FilledStacks 4 роки тому

      i can not. it's in the provider library. google provider github and you'll find the repo.

  • @RawebCoIl
    @RawebCoIl 4 роки тому

    hi,
    thank you for this guide.
    i get error in this line: if (granted) {
    error i get: conditions must have a static type of bool...
    the android studio tell me to add != null
    what do you think?

    • @FilledStacks
      @FilledStacks 4 роки тому

      You're welcome. I don't know man, Android studio is very confusing to me

    • @ShivamKaushik14
      @ShivamKaushik14 4 роки тому +2

      the value for granted is of the type PermissionStatus for you want to use (granted == PermissionStatus.granted)

    • @jucescab
      @jucescab 4 роки тому

      @@ShivamKaushik14 This works for me!

  • @sasaharukh8575
    @sasaharukh8575 3 роки тому

    this technique also works when the app will be in background?

    • @FilledStacks
      @FilledStacks 3 роки тому +1

      for background updates you'll have to start the service using an Android service and do some additional work to wake up the app from the background if you need updates.

    • @sasaharukh8575
      @sasaharukh8575 3 роки тому

      it would be great if you make a video on that

    • @FilledStacks
      @FilledStacks 3 роки тому +1

      @@sasaharukh8575 I'll think about doing that as I'm planning what I want to cover next.

    • @aksanabuster1874
      @aksanabuster1874 3 роки тому +1

      @@FilledStacks please do this! you're fairly easy to follow and we would truly benefit from the hoped-for video, regarding how to get location while the app is not open.

    • @FilledStacks
      @FilledStacks 3 роки тому

      @@aksanabuster1874 Hey, there's a package now that does that which you can use.
      If the user allows it it'll work, if their battery settings doesn't turn off background data then you can get it as well. But it's a fleeting feature, it'll soon get banned completely on ios and Android. Or no one will allow it.

  • @bibash3128
    @bibash3128 4 роки тому

    So stream is alternative to rxdart

    • @FilledStacks
      @FilledStacks 4 роки тому

      No, rxdarts is built ontop of streams. RxDart you use for use cases more advanced than streams. It's streams++ basically.

    • @bibash3128
      @bibash3128 4 роки тому

      @@FilledStacks I have seen people implementing rxdart using Bloc.. can we implement rxdart using provider?

    • @kirill4531
      @kirill4531 4 роки тому +1

      @@bibash3128 you mean people implemented BLoC using RxDart?
      Provider itself is a Dependency Injection lib, if you want to use it you can impement MVVM pattern with it

  • @souravmenonvkp7538
    @souravmenonvkp7538 3 роки тому

    how to calculate distance covered in this code

    • @FilledStacks
      @FilledStacks 3 роки тому

      There's a calculation to get distance between two coordinatea. You can use that one.

    • @souravmenonvkp7538
      @souravmenonvkp7538 3 роки тому

      @@FilledStacks how l will access values from the stream

    • @FilledStacks
      @FilledStacks 3 роки тому

      @@souravmenonvkp7538 The same way we do in this video

  • @MrDacheetz
    @MrDacheetz 2 роки тому

    Aweh, South Africa.

  • @chomanthapa
    @chomanthapa 2 роки тому

    How can we run this in background?

    • @FilledStacks
      @FilledStacks 2 роки тому

      Start it as a Background Sticky service in Android. On iOS You'll have to enable background services and use a long running task.

    • @chomanthapa
      @chomanthapa 2 роки тому

      @@FilledStacks Could you break it down a bit? or can you point out a reference?

    • @FilledStacks
      @FilledStacks 2 роки тому +1

      I can not. I would google Sticky service in Android and Long running task in ios and then go from there.

  • @SahharYoucef
    @SahharYoucef 4 роки тому +1

    I think there is no reason to create a model.

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      Well then you probably shouldn't 😊 never do things if you don't need to 😬

  • @zucca6342
    @zucca6342 4 роки тому

    Thanks for this ariticle, It was really helpful for me.
    So, I have one question about marker on google map.
    First, Please refer this UA-cam link.
    ua-cam.com/video/dq-ksuP0zEc/v-deo.html
    Under this video, as you see, Marker moved smoothly.
    Actually, I living in the country where Directions API are not available.
    that’s why I ask to you like this.
    If you possible, Could you let me know how to implement marker on map like this?
    I would be grateful if you could attach any sample codes.

    • @FilledStacks
      @FilledStacks 4 роки тому

      To move the marker smoothly you have to set it's value using an AnimationController and animate to your final value instead of setting it directly.

  • @madhusudanannair4359
    @madhusudanannair4359 4 роки тому +1

    You should monetize your channel mann.. b'coz you are giving the GitHub code free... Thanks Man..

    • @FilledStacks
      @FilledStacks 4 роки тому +1

      I do monetise my channel :) I'm hoping less people will use ad block to support the channel over the long run :)

  • @markdioneeb8997
    @markdioneeb8997 11 місяців тому

    If you implemented this on a pushed route and pop and pushed the route again, you will encounter:
    Flutter : Bad state: Stream has already been listened to
    My solution to this is update controller in LocationService:
    import 'package:rxdart/rxdart.dart';
    final StreamController _locationController = BehaviorSubject();
    Then it will work perfectly again!

    • @FilledStacks
      @FilledStacks 11 місяців тому +1

      Yeah, a behavior subject there works. or a broadcast controller as well.