createAppwriteMainWithoutOnBoarding static method

Future<void> createAppwriteMainWithoutOnBoarding(
  1. String projectName
)

Implementation

static Future<void> createAppwriteMainWithoutOnBoarding(
    String projectName) async {
  final File mainFile = File('lib/main.dart');
  mainFile.writeAsStringSync('''
import 'package:flutter/material.dart';
import 'package:appwrite/appwrite.dart';
import 'package:$projectName/features/auth/service/auth_status.dart';
import 'package:$projectName/features/auth/ui/auth_screen.dart';
import 'package:provider/provider.dart';
import 'package:$projectName/shared/nav_bar.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Client client = Client();
client = Client()
    .setEndpoint("<YOUR_PROJECT_ENDPOINT>")
    .setProject("<YOUR_PROJECT_ID>");
Account account = Account(client);

runApp(ChangeNotifierProvider(
  create: (context) => AuthService(),
  child: MyApp(
    account: account,
  ),
));
}

class MyApp extends StatelessWidget {
final Account account;
const MyApp({
  required this.account,
  super.key,
});

@override
Widget build(BuildContext context) {
  final value = context.watch<AuthService>().status;
  return MaterialApp(
    debugShowCheckedModeBanner: false,
    theme: ThemeData(
      useMaterial3: true,
    ),
    home: value == AuthStatus.uninitialized
        ? const Scaffold(
            body: Center(child: CircularProgressIndicator()),
          )
        : value == AuthStatus.authenticated
            ? const NavigationScreen()
            : const AuthScreen(),
  );
}
}

''');
}