Skip to content

Desktop (Windows/Linux) support #51

Description

@marandaneto

https://posthog.com/questions/flutter-for-windows-support
https://posthoghelp.zendesk.com/agent/tickets/16890 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/20254)

The Flutter SDK depends on the Android and iOS SDK.
Ideally, the SDK would also have a pure Dart client that works on Desktop or we should embed a Native SDK for Desktop such as the Rust SDK.

macOS is supported already.

Activity

  1. marandaneto commented on Oct 9, 2023

    @marandaneto
    MemberAuthor

    A workaround, for now, would be to create a Flutter bridge and call a Native SDK via FFI, eg, Rust SDK

  2. dariyooo commented on Jan 14, 2024

    @dariyooo

    Is there anything planned in regard to this?
    I would like to switch to this plugin but I need desktop support.

  3. marandaneto commented on Jan 15, 2024

    @marandaneto
    MemberAuthor

    @CaptainDario unfortunately not yet, but please upvote for gathering interest.

    We'd need to write a pure Dart SDK (not depending on the Native SDKs such as Android and iOS for Desktop) or embed a Native SDK for Desktop, such as the Rust SDK.

    However, adding macOS support should be easier since the iOS SDK supports a macOS target.

    Which targets do you need? Win/Lin/macOS or all of them?

  4. dariyooo commented on Jan 15, 2024

    @dariyooo

    Thank you for the quick response! I upvoted this issue.

    I would need support for all platforms. But I also see quite an opportunity in supporting these platforms for this package. Because firebase does not support desktop, and everybody needing desktop support will look somewhere else (just like me)

  5. marandaneto commented on Jan 15, 2024

    @marandaneto
    MemberAuthor

    A quick workaround, for now, is to just call the API directly until we provide first-class support for Flutter Desktop.

  6. dariyooo commented on Jan 15, 2024

    @dariyooo

    I totally missed the direct API access, this seems like a good solution.

  7. dariyooo commented on Jan 15, 2024

    @dariyooo

    @marandaneto How can I overwrite the default timestamp?
    When I try to set it the events are not registered anymore in the web UI.

    This works and the event is registered in the UI

    Map response = jsonDecode((await http.post(
        Uri.parse('https://eu.posthog.com/capture/'),
        headers: {
          "Content-Type": "application/json",
        },
        body: jsonEncode({
          "api_key": Env.POSTHOG_API_KEY,
          "event": eventName,
          "properties" : completeProps,
          //"timestamp" : DateTime(2023, 10, 5).toIso8601String(),
        })
      )).body);

    this even is not registered.

    Map response = jsonDecode((await http.post(
        Uri.parse('https://eu.posthog.com/capture/'),
        headers: {
          "Content-Type": "application/json",
        },
        body: jsonEncode({
          "api_key": Env.POSTHOG_API_KEY,
          "event": eventName,
          "properties" : completeProps,
          "timestamp" : DateTime(2023, 10, 5).toIso8601String(),
        })
      )).body);

    However, in both cases, the return value is "{status: 1}".
    Do you have an idea how to overwrite it?

    Edit: It works I had the time filters set to 24h.

  8. dariyooo commented on Jan 15, 2024

    @dariyooo

    For anybody finding this, the current time can be set with (DateTime.now().toUtc()).toIso8601String().

  9. marandaneto commented on Jan 15, 2024

    @marandaneto
    MemberAuthor

    For anybody finding this, the current time can be set with (DateTime.now().toUtc()).toIso8601String().

    Yes, the docs mention the ISO8601 format.

  10. dariyooo commented on Jan 15, 2024

    @dariyooo

    Yes, the format is mentioned, but they did not mention (or I did not see) that the time needs to be normalized to UTC. When sending my time zone (UTC+1), the server did not return an error, it sent the same response as with UTC but the data was not visible in the dashboard.

    If this is obvious, I am sorry to spam this issue, I thought somebody else may have the same problems.

  11. changed the title [-]Desktop support[/-] [+]Desktop (Windows/Linux) support[/+] on Jan 17, 2024
  12. marandaneto commented on Jan 17, 2024

    @marandaneto
    MemberAuthor
  13. stephane-archer commented on May 15, 2024

    @stephane-archer

    I hope to see a Windows version even if it's a quick and dirty version with helpers that call the API directly.

  14. 1 remaining item

  15. mcquenji commented on Dec 29, 2024

    @mcquenji

    I've put together a quick 'n dirty posthog dart client https://github.com/necodeIT/posthog_dart for anyone interested

  16. Dieterbe commented on Apr 1, 2025

    @Dieterbe

    is there a way to gracefully turn off posthog on unsupported platforms such as linux?

    i have a codebase which i run for web (in production) and linux (for testing), so i'm happy with just the web support. but when i run on linux i get errors like:

    [ERROR:flutter/runtime/dart_vm_initializer.cc(40)] Unhandled Exception: MissingPluginException(No implementation found for method screen on channel posthog_flutter)
    #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:368:7)
    <asynchronous suspension>
    #1      PosthogFlutterIO.screen (package:posthog_flutter/src/posthog_flutter_io.dart:60:7)
    <asynchronous suspension>
    #2      _ProgrammerScreenState.initState (package:bodybuild/ui/programmer/page/programmer.dart:227:5)
    <asynchronous suspension>
    
    

    i have tried a patch like:

       await Posthog().setup(config);
     
    +  if (!kIsWeb) {
    +    await Posthog().disable();
    +  }
    +
    

    but that just results in a black screen when i start the app on linux.

    the only "solution" i see is wrapping every single call to Posthog()... with an kIsWeb check, obviously that's quite messy and i want to avoid that.

  17. marandaneto commented on Apr 7, 2025

    @marandaneto
    MemberAuthor

    re https://posthog.com/questions/flutter-sdk-disable-for-unsupported-targets
    @Dieterbe I think we have to have a NoOp at least so it does nothing on Linux and Window

  18. Dieterbe commented on Apr 7, 2025

    @Dieterbe

    @marandaneto wow! this looks good. i was thinking that we'd manually set the no-op mode based on the platform, but doing it automatically works even better I think.

  19. fingoldo commented on Dec 15, 2025

    @fingoldo

    It's so weird. On your website you claim you ship fast. But you could not ship a Windows Desktop support in 3 years?

  20. marandaneto commented on Feb 26, 2026

    @marandaneto
    MemberAuthor

    It's so weird. On your website you claim you ship fast. But you could not ship a Windows Desktop support in 3 years?

    That's a matter of prioritization and not speed of shipping
    PostHog has support for many products, and a wide range of SDKs https://posthog.com/docs/libraries
    Implementing this requires implementing a new SDK (pure Dart SDK?) that works across Win/Linux, since this is just a wrapper on top of Android/Apple/Web
    Or try to compile another SDK for those platforms eg .NET SDK, Rust, Pure Java, etc, since they work across all platforms.

    Happy to review PRs btw!

  21. stephane-archer commented on Feb 26, 2026

    @stephane-archer

    If you have a rust SDK can't you just use it and just forward the calls using dart? Also, can't it just call the Rest API directly?

    I currently use a competitor product because of the lack of windows support on your side, I'm really interested in using your product instead. it's sad that your priorities doesn't match my need. I personally think windows support is a huge opportunity regarding dart desktop app (usually phone app with a window version)

  22. marandaneto commented on Feb 27, 2026

    @marandaneto
    MemberAuthor

    @stephane-archer #170 (comment)
    A Rust SDK already exists, but it's stateless (for backend use). We'd need to adapt and add a stateful mode as well, similar to our Node and RN SDKs, which share a core module.

  23. stephane-archer commented on Feb 28, 2026

    @stephane-archer

    @marandaneto Thanks for the clarification, and apologies if I’m missing something here. I understand that a stateful implementation would be needed to support the full feature set. That said, would it be possible to expose at least part of the functionality using the current Rust SDK as it stands?

    Even partial Windows support would already be a meaningful step forward for us and might be sufficient to justify switching.

  24. marandaneto commented on Feb 28, 2026

    @marandaneto
    MemberAuthor

    #313 is a great start, no testing at all, just using claude do its best for now but its a PoC

  25. andronedev commented on Jun 5, 2026

    @andronedev

    any updates ?

  26. marandaneto commented on Sep 22, 2026

    @marandaneto
    MemberAuthor

    any updates ?

    sorry we've not prioritized this yet, we'll be having a new planning tomorrow and i'll get you an update if its something we're gonna do soon

  27. ivradonov commented on Sep 25, 2026

    @ivradonov

    any updates ?

    sorry we've not prioritized this yet, we'll be having a new planning tomorrow and i'll get you an update if its something we're gonna do soon

    Hello, do you have any updates on prioritization?

  28. dustinbyrne commented on Sep 30, 2026

    @dustinbyrne
    Contributor

    Hello, do you have any updates on prioritization?

    hey there! we're currently reviewing #621 as a resolution for this. feel free to leave feedback if you try it out 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions