Yeah, sure this is possible in Flutter. You probably want to read into Flutter AppLifecycle events. Using those, you can determine when the app is active and stops being active. You simply need to keep track of time-stamps between these events (and probably need to store them via the `shared_preferences` plugin).
Note that you would need to store the time in a higher resolution than hours though, like in seconds. If you use hours, and the user used your app for 30 seconds -- that would round to '0' hours, and would eventually add nothing to the total active time. So store it in seconds, and when you request the value, divide it by 3600 to get the number of hours.
Hope this helps.