add google analytics to flutter_tools (#3523)

* add google analytics

* send in the run target type

* track device type targets

* use the real GA code

* review comments

* rev to usage 2.0

* rev to 2.2.0 of usage; add tests

* review comments
diff --git a/packages/flutter_tools/lib/src/commands/create.dart b/packages/flutter_tools/lib/src/commands/create.dart
index 6a2269a..122294c 100644
--- a/packages/flutter_tools/lib/src/commands/create.dart
+++ b/packages/flutter_tools/lib/src/commands/create.dart
@@ -5,7 +5,6 @@
 import 'dart:async';
 import 'dart:io';
 
-import 'package:args/command_runner.dart';
 import 'package:path/path.dart' as path;
 
 import '../android/android.dart' as android;
@@ -14,19 +13,10 @@
 import '../cache.dart';
 import '../dart/pub.dart';
 import '../globals.dart';
+import '../runner/flutter_command.dart';
 import '../template.dart';
 
-class CreateCommand extends Command {
-  @override
-  final String name = 'create';
-
-  @override
-  final String description = 'Create a new Flutter project.\n\n'
-    'If run on a project that already exists, this will repair the project, recreating any files that are missing.';
-
-  @override
-  final List<String> aliases = <String>['init'];
-
+class CreateCommand extends FlutterCommand {
   CreateCommand() {
     argParser.addFlag('pub',
       defaultsTo: true,
@@ -46,10 +36,23 @@
   }
 
   @override
+  final String name = 'create';
+
+  @override
+  final String description = 'Create a new Flutter project.\n\n'
+    'If run on a project that already exists, this will repair the project, recreating any files that are missing.';
+
+  @override
+  final List<String> aliases = <String>['init'];
+
+  @override
+  bool get requiresProjectRoot => false;
+
+  @override
   String get invocation => "${runner.executableName} $name <output directory>";
 
   @override
-  Future<int> run() async {
+  Future<int> runInProject() async {
     if (argResults.rest.isEmpty) {
       printStatus('No option specified for the output directory.');
       printStatus(usage);