jonataslaw / get_cli

Official Getx CLI
Apache License 2.0
578 stars 165 forks source link

Get_cli errors on the latest version of flutter #243

Open maxwelladapoe opened 6 months ago

maxwelladapoe commented 6 months ago

I am trying to run get_cli on the latest version of Flutter/dart however I seem to get the below error image

below is my version of flutter image

BOFOII commented 5 months ago

I experienced the same problem, this happened because waitFor will be removed in the next dart, I added the --enable_deprecated_wait_for flag but it still couldn't solve the problem

maxwelladapoe commented 5 months ago

Upon further investigation the issue has more to do with dcli than this package. you will have to downgrade flutter and dart for now if you still need to use this package. I believe once its fixed in dcli you should be able to use it again

gktirkha commented 5 months ago

I found a workaround as get init is not working, we only need to manually initialize the project, and we can still add pages. hope the issue will get resolved, but till then

we can still use

// use this option for Getx_pattern
get create page:home

and

// use this option for CLEAN (by Arktekko)
get create screen:home 

add get dependency, create the home screen, then you can edit the main file based on your architecture

for Getx_pattern

import 'package:flutter/material.dart';

import 'package:get/get.dart';

import 'app/routes/app_pages.dart';

void main() {
  runApp(
    GetMaterialApp(
      initialRoute: AppPages.INITIAL,
      getPages: AppPages.routes,
    ),
  );
}

for CLEAN main.dart

import 'package:flutter/material.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatelessWidget {
  const MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text('Hello World!'),
        ),
      ),
    );
  }
}

config.dart

class Environments {
  static const String PRODUCTION = 'prod';
  static const String QAS = 'QAS';
  static const String DEV = 'dev';
  static const String LOCAL = 'local';
}

class ConfigEnvironments {
  static const String _currentEnvironments = Environments.LOCAL;
  static final List<Map<String, String>> _availableEnvironments = [
    {
      'env': Environments.LOCAL,
      'url': 'http://localhost:8080/api/',
    },
    {
      'env': Environments.DEV,
      'url': '',
    },
    {
      'env': Environments.QAS,
      'url': '',
    },
    {
      'env': Environments.PRODUCTION,
      'url': '',
    },
  ];

  static Map<String, String> getEnvironments() {
    return _availableEnvironments.firstWhere(
      (d) => d['env'] == _currentEnvironments,
    );
  }
}
knottx commented 4 months ago
dart pub global deactivate get_cli

dart pub global activate -s git https://github.com/knottx/get_cli.git --git-ref knottx
jaxnz commented 4 months ago
dart pub global deactivate get_cli

dart pub global activate -s git https://github.com/knottx/get_cli.git --git-ref knottx

Works perfectly - only dependancies required updating