Home > Back-end >  Copying source code using raw.githubusercontent.com
Copying source code using raw.githubusercontent.com

Time:04-02

For example, I want to copy the user code in this link. I have to do this using flutter. https://raw.githubusercontent.com/iampawan/FlutterExampleApps/master/main.dart

maybe i need to copy it to a txt file. I don't know what to use. I searched but didn't understand enough. if there is any other option to copy the raw code i would like to know that too.

thanks.

CodePudding user response:

You can use either the HTTP Package or the DIO Package for this. I Recommend you using DIO.

You can send a GET Request to the URL you need, and it will return the content of the file you requested.

example with DIO:

Response response;
var dio = Dio();
response = await dio.get('https://raw.githubusercontent.com/iampawan/FlutterExampleApps/master/main.dart');
print(response.data.toString());

for more info and usage please reffer to the posted plugins links.

  • Related