meta_seo 2.0.2 copy "meta_seo: ^2.0.2" to clipboard
meta_seo: ^2.0.2 copied to clipboard

Meta SEO is package for adding meta data for html document in head tag which meta tags or meta data make search engine optimization for web apps.

Meta Seo #

Flutter package for Meta SEO.

Screenshots #

Screen Shot 2022-10-08 at 12 01 33 PM

About: #

  • Meta SEO is package for adding meta data for html document in head tag which meta tags or meta data make search engine optimization for web apps.

Installation and Basic Usage #

First: Add to pubspec.yaml:

dependencies:
  meta_seo: ^2.0.2

Second: import it to your project:

import 'package:meta_seo/meta_seo.dart';
import 'package:flutter/foundation.dart';

Then add the config MetaSEO method before the running of the Flutter app into main.dart file:

void main() {
  // It is required to add the following to run the meta_seo package correctly
  // before the running of the Flutter app
  if (kIsWeb) {
    MetaSEO().seoMetaConfig();
  }
  runApp(const MyApp());
}

Finally add MetaSEO into your target web pages:

@override
Widget build(BuildContext context) {

  // Add MetaSEO just into Web platform condition
  if(kIsWeb) {
    // Define MetaSEO object
    MetaSEO meta = MetaSEO();
    // add meta seo data for web app as you want
    meta.seoAuthor('Eng Mouaz M AlShahmeh');
    meta.seoDescription('Meta SEO Web Example');
    meta.seoKeywords('Flutter, Dart, SEO, Meta, Web');
  }

  return const Scaffold(
    body: Center(child: Text('Meta SEO Web Example')),
  );
}

Other example with GoRouter package #

First: Add to pubspec.yaml:

dependencies:
  meta_seo: ^2.0.2
  go_router: ^5.2.0 # Add the latest version

Second: The same as before and add the config MetaSEO method before the running of the Flutter app into main.dart file:

void main() {
  // It is required to add the following to run the meta_seo package correctly
  // before the running of the Flutter app
  if (kIsWeb) {
    MetaSEO().seoMetaConfig();
  }
  runApp(const MyApp());
}

Then follow GoRouter configuration steps and latest add MetaSEO into your GoRouter as you want:

final router = GoRouter(
  initialLocation: '/',
  routes: <GoRoute>[
    GoRoute(
      path: '/',
      builder: (BuildContext context, GoRouterState state) {
        // Add MetaSEO just into Web platform condition
        if(kIsWeb) {
          // Define MetaSEO object
          MetaSEO meta = MetaSEO();
          // add meta seo data for web app as you want
          meta.seoOGTitle('First Screen');
          meta.seoDescription('First Screen');
          meta.seoKeywords('Flutter, Dart, SEO, Meta, Web');
        }

        return const FirstScreen();
      },
    ),
    GoRoute(
      path: '/second_screen',
      builder: (BuildContext context, GoRouterState state) {
        // Add MetaSEO just into Web platform condition
        if(kIsWeb) {
          // Define MetaSEO object
          MetaSEO meta = MetaSEO();
          // add meta seo data for web app as you want
          meta.seoOGTitle('Second Screen');
          meta.seoDescription('Second Screen');
          meta.seoKeywords('Flutter, Dart, SEO, Meta, Web');
        }

        return const SecondScreen();
      },
    ),
  ],
);

Make sure to check out go_router_meta_seo_example project. If you find this package useful, star my example GitHub repository.

Thank you #

Make sure to check out example project. If you find this package useful, star my GitHub repository.

Flutter plugin was developed by: Eng Mouaz M. Al-Shahmeh

152
likes
0
pub points
97%
popularity

Publisher

unverified uploader

Meta SEO is package for adding meta data for html document in head tag which meta tags or meta data make search engine optimization for web apps.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_lints

More

Packages that depend on meta_seo