Name Plus

Automatically increment File & Directory name and create.

Getting Started

In the pubspec.yaml of your flutter project, add the following dependency:

dependencies:
  name_plus: ^0.0.1

Next we need to install this

# Dart
pub get

# Flutter
flutter packages get

In your library add the following import:

import 'package:name_plus/name_plus.dart';

Usage

create File with extension

File('path').namePlus('filename');

File('path').namePlusSync('filename');

create Directory with extension

Directory('path').namePlus('filename');

Directory('path').namePlusSync('filename');

Options

When creating a File or Directory, you can pass some options:

File('path').namePlus(
'filename',
format: '(d)', // change increment number format
space: false, // space between name & number format
);

Documentation

Check test.txt file name from example folder path and then name not exist create test.txt or name is already exist create with default format test 1.txt

File('example').namePlus('test.txt');
// test 1.txt

If you use format option, d is number place.

File('example').namePlus('test.txt', format: '(d)');
// test (2).txt

File('example').namePlus('test.txt', format: '{d}');
// test {3}.txt

GitHub

View Github