18

Essentially , what I want to do is , press a button that I program in Flutter and when that button is pressed , a python script should start running on my Android device .

I want to use youtube-dl (used to download Youtube videos) library in python but I wanna know if there is a way to run the library in flutter .

Any Help is appreciated . Thanks in advance .

Ankit Chawla
  • 364
  • 1
  • 5
  • 12
  • You need to provide more info about what you are doing in Python. Based on your history you may switch to a Flutter/Dart based web scrapping package like [scrapy](https://pub.dev/packages/scrapy). – Morrison Chang Jan 11 '20 at 19:58
  • edit made : i want to use youtube-dl library in python but i wanna execute that script using flutter – Ankit Chawla Jan 11 '20 at 20:21
  • 2
    I would advise learning about mobile before trying to build a mobile app. Generally if you can avoid using different languages as there are compromises (including what can be done in Flutter & React Native) rather than trying to tack on Python which isn't native to Android, iOS or Flutter. Also requests for libraries or tutorials is considered off-topic. You are better off finding and trying a library and showing what errors/problems you are encounter on StackOverflow. – Morrison Chang Jan 11 '20 at 20:52
  • 1
    @MorrisonChang I don't know that I know!! – user1241241 May 15 '20 at 11:25

4 Answers4

9

I know it's quite old now but may be someone else can get help out of it. There is library called starflut and it can incorporate python code inside your flutter app. Take a look here

https://pub.dev/packages/starflut

Hasandroid
  • 336
  • 5
  • 12
  • @AnkitChawla I am also working with this library but trying to add some python libraries to run my code. Do you play around with this library and have added any external library in it? – Hasandroid Jun 12 '20 at 10:50
  • Is there any success to add external library and get it run using starflut? – Purvik Rana Aug 24 '21 at 12:45
  • 1
    Note that Starflut claims to be open-source, but it is not: https://github.com/srplab/starcore_for_flutter/issues/27 – bitinerant Dec 05 '21 at 19:35
3

If you want to use pip packages with a python script, I suggest you, chaquopy package, as it allows you to use the majority of text-based pip packages.

Jay Dangar
  • 3,271
  • 1
  • 16
  • 35
1

I think you should create a flask API in python and deploy it in the Heroku platform. After getting the endpoint of that API you can request that API in flutter easily.

parth panchal
  • 339
  • 4
  • 14
  • Suppose I want to use instaloader package(its a package to download stuffs from instagram) of python and I create one flask api for that to consume in flutter, so basicaly I want to make request to that api and it will download me the requested material but the problem here is the script file is deployed in flask server and it will download there on my flask server and not on users flutter app how can we solve this @parthpanchal – Mithson Feb 01 '23 at 03:38
0

Yes, you can run python scripts using this package you can also modules to the script using this method

`List<Module> modules = [    
Module("Flask", "2.1.2"),    
Module("requests", "0.11.1"),    
Module("numpy", "1.22.3"),
];`

pythonScript.addModules(modules);
balu k
  • 3,515
  • 2
  • 14
  • 29