androidflutterdartemoji

Emoji's aren't dispalying in Flutter web, they are black and white


I am trying to print emojis on flutter app, but I am not seeing the emojis as such but seeing outline of those emojis (Sharing Screenshot below).

I have two files coursedata.dart and coursedescription.dart, The coursedata file contains information of courses that I am going to display in the coursedescription file.

This is what I am seeing when running the app. Below is what I am expecting as the output

🥪 Broccoli and Corn Footlong

🥪 Open Cheese Spinach Toasties

🥪 Mexican Cheese Pockets

🥪 Mumbai Toast

🥪 Chilly Cheese Sandwich

🥪 Veg Cheese Grilled Sandwich

🥪 Paneer Tikka Open Sandwich

🥪 Cheese Burst Pizza Sandwich

🥪 Paneer Toofani Sandwich

🥪 Hulk Sandwich

This is one of the course list in coursedata.dart

Course(
      id: '3',
      title: 'Cafe Style Sandwiches',
      time: '11:00AM - 3:00PM',
      imagePath: 'Cafe_Style_Sandwiches3.png',
      noOfItems: '10',
      items: '''🥪 Broccoli and Corn Footlong 
🥪 Open Cheese Spinach Toasties 
🥪 Mexican Cheese Pockets
🥪 Mumbai Toast
🥪 Chilly Cheese Sandwich
🥪 Veg Cheese Grilled Sandwich
🥪 Paneer Tikka Open Sandwich
🥪 Cheese Burst Pizza Sandwich
🥪 Paneer Toofani Sandwich
🥪 Hulk Sandwich''',
      imagePaths: [],
      language: 'English',
      certificateofCompletion: '', //Show Sample
      highlights: '',
      description:
          'Join our Sandwich-Making course to learn the tricks of the trade. From old-school favorites to new and exciting creations, you will become a sandwich pro, making delicious flavors that everyone will love.',
      price: 'Rs.2000'),

Following is my the container that contains the list for coursedescription.dart

Container(
          margin: const EdgeInsets.only(right: 15, left: 15),
          alignment: Alignment.bottomLeft,
          child: Text(course.items),
        ),

What should I do to get the emojis this way?


Solution

  • It seems like the problem is found in this GitHub issue.

    The solution would be to add:

    engineInitializer.initializeEngine({
      useColorEmoji: true,
    });
    

    To your index.html file located at <project-dir/web/index.html.

    So, change your index.html from:

    onEntrypointLoaded: function(engineInitializer) {
              engineInitializer.initializeEngine().then(function(appRunner) {
                useColorEmoji: true,
                appRunner.runApp();
              });
    

    To:

    onEntrypointLoaded: function(engineInitializer) {
              engineInitializer.initializeEngine(
              {useColorEmoji:true} 
              ).then(function(appRunner) {
                useColorEmoji: true,
                appRunner.runApp();
              });
    

    Images from Chrome:

    Before

    enter image description here

    After

    enter image description here