title: How can I import a variable from one .dart file to another in flutter
body: <p>I am trying to learn flutter from udacity and one of the task is to import variables from main.dart files to the category.dart in order to create a new widget.</p>
  <p>Unfortunately I couldn't manage to import the _categoryIcon in the main dart file to category dart. (also the _categoryName and _categoryColor) here is the main.dart file:</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:unispero/category.dart';
  
  const _categoryName = 'Cake';
  const _categoryIcon = Icons.cake;
  const _categoryColor = Colors.green;
  
  /// The function that is called when main.dart is run.
  void main() {
    runApp(UnitConverterApp());
  }
  
  /// This widget is the root of our application.
  /// Currently, we just show one widget in our app.
  class UnitConverterApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return MaterialApp(
        debugShowCheckedModeBanner: false,
        title: 'Unit Converter',
        home: Scaffold(
          backgroundColor: Colors.green[100],
          body: Center(
            // TODO: Determine what properties you'll need to pass into the widget
            child: Category(_categoryColor, _categoryIcon, _categoryName),
          ),
        ),
      );
    }
  }
  </code></pre>
  <p>and here is the category.dart:</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:unispero/main.dart';
  
  
  class Category extends StatelessWidget {
    /// Creates a [Category].
    ///
    /// A [Category] saves the name of the Category (e.g. 'Length'), its color for
    /// the UI, and the icon that represents it (e.g. a ruler).
    // TODO: You'll need the name, color, and iconLocation from main.dart
    const Category(_categoryColor, _categoryIcon, _categoryName);
  
    /// Builds a custom widget that shows [Category] information.
    ///
    /// This information includes the icon, name, and color for the [Category].
    @override
    // This `context` parameter describes the location of this widget in the
    // widget tree. It can be used for obtaining Theme data from the nearest
    // Theme ancestor in the tree. Below, we obtain the display1 text theme.
    // See https://docs.flutter.io/flutter/material/Theme-class.html
    Widget build(BuildContext context) {
      // TODO: Build the custom widget here, referring to the Specs.
      // const _categoryIcon = Icons.cake;
      // IconData? _categoryIcon;
      return Container(
        // width: 50,
        child: Row(children: &lt;Widget&gt;[
          Icon(_categoryIcon),
        ]),
  
        height: 100,
        color: Colors.blueAccent,
      );
    }
  }
  </code></pre>
  <p>Sorry if this is an easy question but I couldn't find the answer</p>