jonataslaw/get_cli

Get_cli errors on the latest version of flutter

maxwelladapoe opened this issue · 5 comments

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

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

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

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,
    );
  }
}

dart pub global deactivate get_cli

dart pub global activate -s git https://github.com/knottx/get_cli.git --git-ref knottx
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