Skip to main content
1

The pubspec.yaml Dance

Summon Flutter Extend into your project by adding this to your pubspec.yaml:
dependencies:
  flutter:
    sdk: flutter
  flutter_extend: ^0.2.0 # Check pub.dev for the latest version
2

Get Packages

Run this spell in your terminal:
flutter pub get
3

Import the Package

Import the package and start your journey to developer enlightenment:
import 'package:flutter_extend/flutter_extend.dart';
4

Start Using the Extensions

You can now start chaining methods directly onto core Flutter classes!
import 'package:flutter/material.dart';
import 'package:flutter_extend/flutter_extend.dart';

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    // 1. Context Extension for screen size
    final screenWidth = context.screenWidth;

    // 2. Widget Extension for chaining layout
    final title = const Text('Welcome to Flutter Extend')
        .padding(const EdgeInsets.all(16.0))
        .center();

    // 3. Animation Extension (Requires flutter_animate)
    final animatedIcon = const Icon(Icons.star, size: 50)
        .fadeInMoveInBottom(duration: 800);

    return Scaffold(
      appBar: AppBar(
        // 4. Context Extension for theme color
        backgroundColor: context.colorScheme.primary,
        title: title,
      ),
      body: Center(
        child: animatedIcon,
      ),
    );
  }
}
Congratulations! You are all set to eliminate boilerplate code and build beautiful, expressive Flutter apps.