Last active
January 25, 2024 06:39
-
-
Save esDotDev/7e14fb1966ccbbad9b1af1d06696d4cb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
org = "com.example" | |
name = "app_name" | |
cmd = "flutter create --org " + org + " --project-name " + name + " ."; | |
packages = [ | |
"cached_network_image", | |
"collection", | |
"copy_with_extension", | |
"equatable", | |
"extra_alignments", | |
"flextras", | |
"gap", | |
"get_it", | |
"get_it_mixin", | |
"json_annotation", | |
"modal_bottom_sheet", | |
"reactives", | |
"simple_rich_text", | |
"sized_context" | |
]; | |
for p in packages: | |
cmd += " && flutter pub add " + packages[packages.index(p)] | |
packages = [ | |
"build_runner", | |
"copy_with_extension_gen", | |
"json_serializable", | |
]; | |
for p in packages: | |
cmd += " && flutter pub add " + packages[packages.index(p)] | |
# Create project | |
os.system(cmd); | |
# Replace main file | |
main = """import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( | |
home: Center(child: FlutterLogo()), | |
); | |
} | |
}""" | |
mainPath = "lib/main.dart"; | |
os.remove(mainPath); | |
f = open(mainPath, "a") | |
f.write(main) | |
f.close() |
thanks for sharing, very helpful, we should add this with mac m1 chip
#!/usr/bin/env python3
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the script. You have missed
--dev
when adding dev packages ;)