How to modify plugins Dart code Flutter?
I am developing a Flutter app, and it uses map_view plugin. I want to add new functionalities to the plugin by modifying the source code. How do I find the actual source code of the plugin in my project after installing it through Flutter?
How plugin is added in Flutter
The dependency for map_view plugin is added to pubspec.yaml as below, then running flutter packages get will add it to the project.
dev_dependecies:
map_view:
With the git reposity of the desired plugin here
Clone it.
Make your modification
Submit a pull request.
And done
We usually use packages by importing them in the files where we need them.
To modify a plugin, you need to Ctrl + click on the import line (for e.g. import 'package:dio/dio.dart';) ctrl + clicking on this line will open the source code for this plugin. You can edit the code there.
Remember, the change won't be permanent and if you push your code to git and then clone it later, the changes you've done will be reverted to the original.
So to avoid this, you can just copy all the source code and make a separate dart file and copy and modify all the code there to play safe.
How plugin is added in Flutter
The dependency for map_view plugin is added to pubspec.yaml as below, then running flutter packages get will add it to the project.
dev_dependecies:
map_view:
With the git reposity of the desired plugin here
Clone it.
Make your modification
Submit a pull request.
And done
We usually use packages by importing them in the files where we need them.
To modify a plugin, you need to Ctrl + click on the import line (for e.g. import 'package:dio/dio.dart';) ctrl + clicking on this line will open the source code for this plugin. You can edit the code there.
Remember, the change won't be permanent and if you push your code to git and then clone it later, the changes you've done will be reverted to the original.
So to avoid this, you can just copy all the source code and make a separate dart file and copy and modify all the code there to play safe.
Comments
Post a Comment