Copying source code using raw.githubusercontent.com

141

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.

Share:
141
muazzez
Author by

muazzez

Updated on January 04, 2023

Comments

  • muazzez
    muazzez over 1 year

    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.

  • muazzez
    muazzez about 2 years
    That's work Srilal thanksss! In addition, those who need it can use it with FutureBuilder.