title: Flutter Undefined name 'context'. Try correcting the name to one that is defined, or defining the name
body: <p>Any help please how do i pass the context in this class
  error says:     Undefined name 'context'.  Try correcting the name to one that is defined, or defining the name.</p>
  <p>when i pass the categories name as a string it works fine like the class below works great</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
  import 'package:domain/classes/localization.dart';
  import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  
  
  
  // products categories
  class Category  {
    int id;
    String name;
    Icon icon;
    Color color;
  
    Category(this.id, this.name, this.icon, this.color);
    static List&lt;Category&gt; getCategories() {
  
      return &lt;Category&gt;[
        Category(0, 'All' ,Icon(Icons.border_all, size: 30.0,), Colors.red),
        Category(1, 'Phones' ,Icon(Icons.phone_android, size: 30.0,), Colors.blue),
        Category(2, 'Electronics', Icon(Icons.devices_other, size: 30.0,), Colors.lightBlue),
        Category(3, 'Woman Fashions',Icon(MdiIcons.humanFemale, size: 30.0,), Colors.pink),
        Category(4, 'Woman Accessories',Icon(MdiIcons.shoeHeel, size: 30.0,), Colors.pink),
        Category(5, 'Man Fashions',Icon(MdiIcons.humanMale, size: 30.0,), Colors.brown),
        Category(6, 'Man Accessories',Icon(MdiIcons.shoeFormal, size: 30.0,), Colors.brown),
        Category(7, 'Baby Child', Icon(Icons.child_care, size: 30.0,), Colors.lightBlueAccent),
        Category(8, 'Sports Outdoors', Icon(Icons.fitness_center, size: 30.0,), Colors.blueAccent),
        Category(9, 'Gaming',Icon(Icons.videogame_asset, size: 30.0,), Colors.deepPurple),
        Category(10, 'Home Appliances', Icon(Icons.home, size: 30.0,), Colors.green),
        Category(11, 'Cars',Icon(Icons.directions_car, size: 30.0,), Colors.blueGrey),
        Category(12, 'Auto Parts', Icon(MdiIcons.carBattery, size: 30.0,), Colors.blueGrey),
        Category(13, 'Trucks Bus', Icon(Icons.local_shipping, size: 30.0,), Colors.blueGrey),
        Category(14, 'Other Vehicles', Icon(Icons.directions_boat, size: 30.0,), Colors.blueGrey),
        Category(15, 'Housing Sale', Icon(MdiIcons.homeGroup, size: 30.0,), Colors.black),
      ];
    }
  </code></pre>
  <p>But i want to set the names of categories to be automatically translated and loaded based on user device language,
  so when i call for the translated name from the localization class it gives me an error</p>
  <pre><code>Undefined name 'context'.  Try correcting the name to one that is defined, or defining the name.
  </code></pre>
  <p>i dont know how to pass the context any help please</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
  import 'package:domain/classes/localization.dart';
  import 'package:flutter/cupertino.dart';
  import 'package:flutter/material.dart';
  
  
  
  // products categories
  class Category  {
    int id;
    String name;
    Icon icon;
    Color color;
  
    Category(this.id, this.name, this.icon, this.color);
    static List&lt;Category&gt; getCategories() {
  
      return &lt;Category&gt;[
        Category(0, DemoLocalizations.of(context).allCategories ,Icon(Icons.border_all, size: 30.0,), Colors.red),
        Category(1, DemoLocalizations.of(context).phones ,Icon(Icons.phone_android, size: 30.0,), Colors.blue),
        Category(2, DemoLocalizations.of(context).electronics, Icon(Icons.devices_other, size: 30.0,), Colors.lightBlue),
      ];
    }
  
  
  }
      
  </code></pre>